当前位置: 首页>>代码示例>>PHP>>正文


PHP Flyer::locatedAt方法代码示例

本文整理汇总了PHP中app\Flyer::locatedAt方法的典型用法代码示例。如果您正苦于以下问题:PHP Flyer::locatedAt方法的具体用法?PHP Flyer::locatedAt怎么用?PHP Flyer::locatedAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Flyer的用法示例。


在下文中一共展示了Flyer::locatedAt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: store

 /**
  * Apply a photo to the referenced flyer.
  * Uses a dedicated form request called AddPhotoRequest.
  *
  * @param string $zip
  * @param string $street
  * @param AddPhotoRequest $request
  */
 public function store($zip, $street, AddPhotoRequest $request)
 {
     // find our flyer
     $flyer = Flyer::locatedAt($zip, $street);
     // store the photo which will be just the UploadedFile instance
     $photo = $request->file('photo');
     // we'll have a dedicated class like AddPhotoToFlyer and it will accept the flyer and the photo upload
     // and if that's its own instance, then we need to new it up and call a save method on it
     // this is an alternative way to do this.
     // if we wanted to treat this as a form object, you could even do your validation within that class rather than here, but in this case its so easy im just going to leave it in
     // and you would no longer need the AddPhotoRequest here.
     // we need to create this. we'll put it in app/Forms/AddPhotoToFlyer
     // we put this in Forms because we are treating this as a forms object
     // or i might have a more dedicated namespace like app/Flyers/AddPhotoToFlyer
     // or if you want you could put it in app/AddPhotoToFlyer and that would be okay too. thats what we will do here.
     (new AddPhotoToFlyer($flyer, $photo))->save();
     // i like using a named constructor. that way i can new up a photo and pass in the columns essentially
     // or if i wanted to fetch these from (in this case) a file's request then its useful to use a named constructor.
     // we'll pass in the photo uploaded file.
     // built up our photo
     // $photo = Photo::fromFile($request->file('photo'))->upload();
     //$photo = Photo::fromFile($request->file('photo'));
     // then we pass the photo to our flyer
     // But what about the process where we upload the file to the proper directory?
     // yes we persist it in the database. but we also need to move it to the folder and create the thumbnail.
     // located the current flyer. associate it with this flyer and save it.
     //Flyer::locatedAt($zip, $street)->addPhoto($photo);
 }
开发者ID:adrianapope,项目名称:project-flyer,代码行数:36,代码来源:PhotosController.php

示例2: addPhoto

 public function addPhoto($zip, $street, AddPhotoRequest $request)
 {
     $flyer = Flyer::locatedAt($zip, $street);
     $file = $request->file('file');
     $photo = $this->makePhoto($file);
     $flyer->savePhoto($photo);
 }
开发者ID:psylanrex,项目名称:project-flyer,代码行数:7,代码来源:FlyersController.php

示例3: addPhoto

 public function addPhoto($zip, $street, Request $request)
 {
     $this->validate($request, ['photo' => 'required|mimes:jpg,jpeg,png,bmp']);
     $photo = Photo::fromForm($request->file('photo'));
     Flyer::locatedAt($zip, $street)->addPhoto($photo);
     //return view('flyers.show',compact('flyer'));
 }
开发者ID:sonfordson,项目名称:Project-Flyer,代码行数:7,代码来源:FlyersController.php

示例4: store

 public function store($zip, $street, AddPhotoRequest $request)
 {
     $flyer = Flyer::locatedAt($zip, $street);
     $photo = $request->file('photo');
     (new AddPhotoToFlyer($flyer, $photo))->save();
     //$photo = Photo::fromFile($request->file('photo'));
     //Flyer::locatedAt($zip, $street)->addPhoto($photo);
 }
开发者ID:garyobrien92,项目名称:project-flyer,代码行数:8,代码来源:PhotosController.php

示例5: addPhoto

 public function addPhoto($zip, $street, ChangeFlyerRequest $request)
 {
     if (!$this->userCreatedFlyer($request)) {
         return $this->unauthorized($request);
     }
     $photo = $this->makePhoto($request->file('photo'));
     Flyer::locatedAt($zip, $street)->addPhoto($photo);
 }
开发者ID:serrati,项目名称:project-flyer,代码行数:8,代码来源:FlyersController.php

示例6: store

 /**
  * Store a new foto.
  *
  * @return \Illuminate\Http\Response
  */
 public function store($zip, $street, Request $request)
 {
     $flyer = Flyer::locatedAt($zip, $street);
     return Response::json($request->file(), 200);
     $photo = $request->file('file');
     $name = $photo->fileName();
     //$photo = Photo::fromFile($request->file('file'))->upload();
     $flyer->photos()->create(['path' => "/flyers/photos/{$name}"]);
 }
开发者ID:qnk,项目名称:laravel-projectFlyer,代码行数:14,代码来源:PhotosController.php

示例7: addPhoto

 public function addPhoto($zip, $street, Request $request)
 {
     $this->validate($request, ['photo' => 'required|mimes:jpg,jpeg,png,bmp']);
     if (!$this->userCreatedFlyer($request)) {
         return $this->unauthorized($request);
     }
     $photo = $this->makePhoto($request->file('photo'));
     Flyer::locatedAt($zip, $street)->addPhoto($photo);
 }
开发者ID:naxjud,项目名称:projectflyer,代码行数:9,代码来源:FlyersController.php

示例8: store

 public function store(Request $request, $zip, $street)
 {
     $this->validate($request, ['photo' => 'required|mimes:jpg,jpeg,png, bmp']);
     if (!$this->userCreatedFlyer($request)) {
         return $this->unauthorized($request);
     }
     $flyer = Flyer::locatedAt($zip, $street);
     $photo = $request->file('photo');
     (new AddPhotoToFlyer($flyer, $photo))->save();
 }
开发者ID:Jimbol4,项目名称:project-flyer,代码行数:10,代码来源:PhotosController.php

示例9: addPhotos

 public function addPhotos($zip, $street, Request $request)
 {
     $this->validate($request, ['photo' => 'mimes:jpg,jpeg,png,bmp']);
     //$file = $request->file('photo'); // paramName
     //$file->move('flyers/photos', $name);
     //$flyer = Flyer::locatedAt($zip, $street)->first();
     $photo = $this->makePhoto($request->file('photo'));
     Flyer::locatedAt($zip, $street)->addPhoto($photo);
     //$flyer->photos()->create(['path' => "flyers/photos/{$name}"]);
 }
开发者ID:kchimbo,项目名称:flyer,代码行数:10,代码来源:FlyersController.php

示例10: addPhoto

 /**
  * Apply a photo to the referenced flyer.
  * @param string  $zip  
  * @param string  $street  
  * @param Request $request 
  */
 public function addPhoto($zip, $street, Request $request)
 {
     $this->validate($request, ['photo' => 'required|mimes:jpg,jpeg,png,bmp']);
     $flyer = Flyer::locatedAt($zip, $street);
     if ($flyer->user_id !== \Auth::id()) {
         if ($request->ajax()) {
             return response(['message' => 'nowayjose'], 403);
         }
         flash('nowayjose');
         redirect('/');
     }
     $photo = $this->makePhoto($request->file('photo'));
     $flyer->addPhoto($photo);
 }
开发者ID:jay-nguyen,项目名称:project-flyer,代码行数:20,代码来源:FlyersController.php

示例11: addPhoto

 public function addPhoto($zip, $street, AddPhotoRequest $request)
 {
     $photo = Photo::fromFile($request->file('photo'));
     Flyer::locatedAt($zip, $street)->addPhoto($photo);
     //        $this->validate($request,[
     //            'photo' => 'required|mimes:jpg,jpeg,png,bmp'
     //        ]);
     //
     //
     //        if(! $this->userCreatedFlyer($request))
     //        {
     //          return $this->unauthorized($request);
     //        }
     //        $photo = $this->makePhoto($request->file('photo'));
     //
     //        Flyer::locatedAt($zip, $street)->addPhoto($photo);
 }
开发者ID:garyobrien92,项目名称:project-flyer,代码行数:17,代码来源:FlyersController.php

示例12: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     /*
     This was a way of validating it using a trait, where the two methods here were defined. 
      
     if (!$this->userCreatedFlyer($request)) {
         return $this->unauthorized($request);
     }
     */
     /* Out with the old...
             $photo = Photo::fromFile($request->file('photo'));
     
             Flyer::locatedAt($request->zip,$request->street)->addPhoto($photo);
             */
     $flyer = Flyer::locatedAt($request->zip, $request->street);
     $photo = $request->file('photo');
     (new AddPhotoToFlyer($flyer, $photo))->save();
 }
开发者ID:anjuna,项目名称:spicy,代码行数:24,代码来源:PhotosController.php

示例13: addPhoto

 public function addPhoto($zip, $street, AddPhotoRequest $request)
 {
     $photo = Photo::fromFile($request->file('photo'));
     Flyer::locatedAt($zip, $street)->addPhoto($photo);
 }
开发者ID:KostyaDevelop,项目名称:ProjectFlyer,代码行数:5,代码来源:FlyersController.php

示例14: store

 /**
  * Apply a photo to the referenced flyer
  * @param $zip
  * @param $street
  * @param AddPhotoRequest $request
  */
 public function store($zip, $street, AddPhotoRequest $request)
 {
     $photo = Photo::fromFile($request->file('file'));
     //$photo = $this->makePhoto($request->file('file'));
     Flyer::locatedAt($zip, $street)->addPhotos($photo);
 }
开发者ID:pranayaryal,项目名称:projectflyer,代码行数:12,代码来源:PhotosController.php

示例15: show

 public function show($zip, $street)
 {
     $street = str_replace('-', ' ', $street);
     return Flyer::locatedAt($zip, $street)->first();
     //return Flyer::where(compact('zip', 'street'))->first();
 }
开发者ID:shwezin,项目名称:Projectflyer,代码行数:6,代码来源:FlyerController.php


注:本文中的app\Flyer::locatedAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。