當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Image::with方法代碼示例

本文整理匯總了PHP中app\Image::with方法的典型用法代碼示例。如果您正苦於以下問題:PHP Image::with方法的具體用法?PHP Image::with怎麽用?PHP Image::with使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\Image的用法示例。


在下文中一共展示了Image::with方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getAll

 public function getAll()
 {
     $period = new Period();
     $current_period = $period->active()->first();
     $img = new Image();
     $periods = $period->all();
     $winners = [];
     $pp_images = !is_null($current_period) ? $img->pastperiod($current_period)->get() : null;
     $rules = ['Hi everyone! Welcome to the Zeal Optics Ski Goggles Game!', 'The game goes on for 4 periods.', 'The photo with the most votes wins!', 'Every period a new winner is selected!', 'The rules are simple: register, post the most amazing and unique photo from your last ski vacation.', 'Sit back, relax and wait until the end of the period!', 'After every period the winners will be published on this page.', 'You can only post once!', 'You can als vote, but also only once for each photo!'];
     $past_periods = $period->past()->get();
     if ($past_periods) {
         foreach ($past_periods as $key => $p) {
             $winners['Period ' . ($key + 1)] = Votes::winners($p);
         }
     }
     $images = $current_period != null ? $img->with('author')->active($current_period)->get() : null;
     return view('home', compact('images', 'winners', 'rules', 'pp_images', 'periods'));
 }
開發者ID:JolitaGrazyte,項目名稱:webdev_examen,代碼行數:18,代碼來源:GameController.php

示例2: index

 public function index()
 {
     $images = Image::with('user')->latest()->paginate(10);
     return view('admin.images.index', compact('images'));
 }
開發者ID:misterebs,項目名稱:cmsku,代碼行數:5,代碼來源:ImageController.php

示例3: image

 public function image(Request $request)
 {
     $query = Image::with('parent', 'user');
     $images = $query->orderBy('created_at', 'desc')->paginate(20);
     return view('pages.admin.image', ['images' => $images]);
 }
開發者ID:santakani,項目名稱:santakani.com,代碼行數:6,代碼來源:AdminController.php

示例4: index

 public function index()
 {
     $images = Image::with('user')->orderBy('created_at', 'DESC')->paginate(10);
     // dd($images);
     return view('admin.images.index', compact('images'));
 }
開發者ID:litemax,項目名稱:LaravelBlog,代碼行數:6,代碼來源:ImageController.php


注:本文中的app\Image::with方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。