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


PHP Image::where方法代码示例

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


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

示例1: getProfile

 /**
  * Display the instructor profile.
  *
  * @return Response
  */
 public function getProfile($id = Null)
 {
     if (isset($id)) {
         //The instructor with the given user_id
         $instructor = User::with('instructor')->has('instructor')->where('active', 1)->find($id);
         if (count($instructor) == 1) {
             //Instructor_id of the instructor
             $instructor_id = $instructor->instructor->instructor_id;
             //All reviews of the instructor
             $reviews = Instructor::find($instructor_id)->reviews()->orderBy('created_at', 'desc')->paginate(2);
             $reviews->setPath('/drive/instructor/profile/83/url');
             //Counting the number of reviews wrote by the current learner for the instructor
             // $no_of_review = Review::where('learner_id', Auth::user()->learner->learner_id)->where('Instructor_id', $instructor_id)->count();
             //Counting total number of reviews of the instructor
             $total_reviews = Instructor::find($instructor_id)->reviews()->count();
             //Calculating the average rating
             $avg_rating = Instructor::find($instructor_id)->reviews()->avg('rating');
             //
             $images = Image::where('instructor_id', $instructor_id)->get();
             //Returning the view with $instructors
             return view('instructor_profile', ['instructor' => $instructor, 'reviews' => $reviews, 'total_reviews' => $total_reviews, 'avg_rating' => $avg_rating, 'images' => $images]);
         } else {
             //If no result, redirect the user to the instructor_list
             //Flashed data contains message and alert-danger class
             return redirect()->action('InstructorController@getIndex')->with('message', 'No instructor profile found!')->with('alert-class', 'alert-danger');
         }
         //End of if statement
     } else {
         //If no id provided, redirect the user to the instructor_list
         return redirect()->action('InstructorController@getIndex');
     }
     //End of if statement
 }
开发者ID:rayeesOrg,项目名称:drive,代码行数:38,代码来源:InstructorController.php

示例2: save

 /**
  * Save product to database
  */
 public function save()
 {
     $data = ['item_id' => $this->item_id, 'shop_id' => $this->shop_id] + $this->data;
     if (!App\Product::where('shop_id', $this->shop_id)->where('item_id', $this->item_id)->update($this->data) && !App\Product::insert($data)) {
         return false;
     }
     $this->id = App\Product::where('shop_id', $this->shop_id)->where('item_id', $this->item_id)->first()->id;
     if (!$this->id) {
         return false;
     }
     foreach ($this->images as $image) {
         if (!App\Image::where('url', $image['url'])->update($image) && !App\Image::insert($image + ['product_id' => $this->id])) {
             return false;
         }
     }
     /*if( isset( $this->params ) )
     		{
     			foreach( $this->params as $param )
     			{
     				if( !App\Param::where( 'param', $param['param'] )->update( $param ) && 
     					!App\Param::insert( $param + [ 'product_id' => $this->id ] ) )
     					return false;
     			}
     		}*/
     return true;
 }
开发者ID:bausano,项目名称:Ebchod,代码行数:29,代码来源:Product.php

示例3: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //
     $images = Image::where('page_id', '=', $_GET)->get();
     $possible_photos = PossiblePhoto::orderBy('created_at', 'ASC')->get();
     return view('images.index', compact('images', 'possible_photos'));
 }
开发者ID:AmilcarCondino,项目名称:circulo,代码行数:12,代码来源:ImagesController.php

示例4: getImages

 public function getImages()
 {
     $user = Auth::User();
     $userID = $user->id;
     $getImages = Image::where('userID', $userID)->get();
     return $getImages;
 }
开发者ID:deferdie,项目名称:tweet,代码行数:7,代码来源:fileManagerController.php

示例5: makeImage

 protected function makeImage($file, $height, $width, $randomFilename, $thumbnail = null)
 {
     $md5 = md5_file($file->getRealPath());
     $img = Image::make($file)->fit($height, $width);
     $path = 'images/';
     if ($thumbnail != null) {
         $path = 'images/thumb/';
     }
     $image = Images::where('md5_hash', $md5)->first();
     if ($image === null or $image->thumbnail_file == null) {
         Clockwork::info('Storing on Filesystem');
         $img->save(storage_path() . '/app/' . $path . $randomFilename . '.png', 90);
     }
     if ($image === null and $thumbnail === null) {
         Clockwork::info('New Image');
         $image = new Images();
         $image->user_id = Auth::user()->id;
         $image->filename = $file->getClientOriginalName();
         $image->file = $randomFilename . '.png';
         $image->height = $height;
         $image->width = $width;
         $image->md5_hash = $md5;
     } elseif ($thumbnail != null and $image->thumbnail_file == null) {
         Clockwork::info('Thumbnail Updated');
         $image->thumbnail_file = $randomFilename . '.png';
     }
     $image->save();
     return $image;
 }
开发者ID:becast,项目名称:GameReviewSite,代码行数:29,代码来源:ImageController.php

示例6: foreach

 function getExample3()
 {
     $images = \App\Image::where('date_taken', '<', '2000-00-00')->get();
     foreach ($images as $image) {
         echo $image->narrative . '<br>';
     }
     dump($images);
 }
开发者ID:dmorgorg,项目名称:dmphotos,代码行数:8,代码来源:PracticeController.php

示例7: show

 /**
  * Show a image based on on the filename
  * @param $filename
  * @return mixed
  */
 public function show($filename)
 {
     $file = Image::where('filename', $filename)->firstOrFail();
     if (!$file) {
         return $this->respondWithError();
     }
     return Fractal::item($file, new \App\Transformers\ImageTransformer())->responseJson(200);
 }
开发者ID:arelstone,项目名称:Gps-RESTfull,代码行数:13,代码来源:ImageController.php

示例8: meta

 /**
  * @return $this
  */
 public function meta()
 {
     $img_url = 'http://d14d0ey1pb5ifb.cloudfront.net/';
     $property = \App\Property::where(['meta_set' => 0, 'status' => '1'])->orderBy('package', 'DESC')->first();
     $address = \App\Address::where(['property_id' => $property->property_id])->first();
     $images = \App\Image::where(['property_id' => $property->property_id])->orderBy('pos', 'ASC')->get();
     return view('dashboard.meta')->with(compact(['property', 'address', 'images', 'img_url']));
 }
开发者ID:brevig907,项目名称:apt,代码行数:11,代码来源:DashboardController.php

示例9: kill

 public function kill()
 {
     $image = Image::where('model_name', '=', 'Article')->where('foreign_id', '=', $this->id)->first();
     if (!empty($image)) {
         $image->kill();
     }
     $this->delete();
 }
开发者ID:jbiesiada,项目名称:blog,代码行数:8,代码来源:Article.php

示例10: afficher

 public function afficher($id_image)
 {
     if (Image::find($id_image)) {
         return View::make('image', ['image' => Image::find($id_image), 'precedente' => Image::where('id_image', '<', Image::find($id_image)->id_image)->where('id_campagne', '=', Image::find($id_image)->id_campagne)->max('id_image'), 'suivante' => Image::where('id_image', '>', Image::find($id_image)->id_image)->where('id_campagne', '=', Image::find($id_image)->id_campagne)->min('id_image')]);
     } else {
         return Response('Image non trouvée');
     }
 }
开发者ID:Alex01723,项目名称:PTUT-CompetitionImage,代码行数:8,代码来源:ImageController.php

示例11: roomHistory

 public function roomHistory($room_id)
 {
     $room_contracts = Contract::withTrashed()->where('room_id', $room_id)->select('id', 'contractor_name', 'phone', 'end_water_degree', 'end_electric_degree', 'start_time', 'end_time', 'real_end_time')->get();
     foreach ($room_contracts as &$contract) {
         $images = Image::where('r_id', $contract['id'])->select('path as img', 'imageable_id', 'r_id')->get();
         $contract['images'] = $images;
     }
     return $room_contracts;
 }
开发者ID:boybin,项目名称:n4backend,代码行数:9,代码来源:ContractRoomController.php

示例12: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show(Family $family)
 {
     $id = $family->id;
     $mother = Person::latest('created_at')->where('id', '=', $family->mother_id)->first();
     $father = Person::latest('created_at')->where('id', '=', $family->father_id)->first();
     $kids = FamilyController::get_kids_of_family($family);
     $images = Image::where('family', $id)->orderBy('year', 'asc')->get();
     $featured_image = Image::latest('created_at')->orderBy('year', 'asc')->Where('family', $id)->Where('featured', 1)->get();
     return view('family.show', compact('family', 'kids', 'images', 'mother', 'father', 'featured_image'));
 }
开发者ID:abada,项目名称:Family-laravel,代码行数:16,代码来源:FamilyController.php

示例13: show

 public function show(Person $person)
 {
     $logged_in_user = \Auth::user();
     $id = $person->id;
     $solo_images = Image::where('subject', $id)->orderBy('year', 'asc')->get();
     $featured_image = Image::where('subject', $id)->orderBy('year', 'asc')->Where('featured', 1)->get();
     $made_family = PeopleController::get_made_family($person);
     $notes = PeopleController::get_notes_about_person($person);
     $origin_family = Family::where('id', $person->family_of_origin)->first();
     return view('person.show', compact('person', 'solo_images', 'made_family', 'featured_image', 'origin_family', 'notes', 'logged_in_user'));
 }
开发者ID:abada,项目名称:Family-laravel,代码行数:11,代码来源:PeopleController.php

示例14: getImage

 /**
  * Get image from storage
  * 
  * @param Request $request
  * @return file
  */
 public function getImage(Request $request)
 {
     /**
      * Check the cache
      */
     $cacheKey = 'image:' . $request->imageName . ':' . $request->imageExtension;
     /**
      * File cached
      */
     if (Cache::has($cacheKey)) {
         $imageMeta = Cache::get($cacheKey);
     } else {
         /**
          * Get META information
          */
         $imageMeta = Image::where(['url' => $request->imageName, 'image_extension' => $request->imageExtension])->first(['image_mime_type', 'image_size', 'id', 'updated_at', 'image_etag']);
         /**
          * File does not exist
          */
         if (empty($imageMeta) == TRUE) {
             App::abort(404);
         }
         /**
          * Save meta information to cache
          */
         Cache::forever($cacheKey, $imageMeta);
     }
     /**
      * Get filename
      */
     $filename = Helpers::getStorageFilename(env('APP_IMAGE_STORAGE_DIRECTORY', 'images'), $imageMeta->id);
     /**
      * Prepare stream
      */
     $stream = Storage::readStream($filename);
     /**
      * File headers
      */
     $headers = array('Content-Description' => 'File Transfer', 'Content-Type' => $imageMeta->image_mime_type, 'Content-Transfer-Encoding' => 'binary', 'Pragma' => 'public', 'Expires' => Carbon::createFromTimestamp(time() + 3600)->toRfc2822String(), 'Last-Modified' => $imageMeta->updated_at->toRfc2822String(), 'Etag' => $imageMeta->image_etag);
     /**
      * Response code cached
      */
     if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == $imageMeta->image_etag || isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $_SERVER['HTTP_IF_MODIFIED_SINCE'] == $imageMeta->updated_at->toRfc2822String()) {
         $responseCode = 304;
     } else {
         $responseCode = 200;
     }
     /**
      * Stream to browser
      */
     return Response::stream(function () use($stream) {
         fpassthru($stream);
     }, $responseCode, $headers);
 }
开发者ID:jdrda,项目名称:olapus,代码行数:60,代码来源:ImageController.php

示例15: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     // return the rental and urls for the images
     $rental = \App\Rental::find($id);
     $images = \App\Image::where('project_id', '=', $id)->get();
     $image_response = [];
     foreach ($images as $image) {
         array_push($image_response, ['url' => config('app.url') . "/images/" . $image->id]);
     }
     $rental['images'] = $image_response;
     return response()->json(['rental' => $rental]);
 }
开发者ID:cfortier2,项目名称:dwa_p4_api,代码行数:18,代码来源:RentalsController.php


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