本文整理汇总了PHP中app\Image::latest方法的典型用法代码示例。如果您正苦于以下问题:PHP Image::latest方法的具体用法?PHP Image::latest怎么用?PHP Image::latest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Image
的用法示例。
在下文中一共展示了Image::latest方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
$sliders = Slider::latest()->get();
$images = Image::latest()->take(4)->get();
$news = News::latest('published_at')->published()->take(3)->get();
$articles = Article::latest('published_at')->published()->take(3)->get();
return view('pages.index', compact('articles', 'news', 'images', 'sliders'));
}
示例2: 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'));
}
示例3: fresh
public function fresh()
{
$images = Image::latest()->get();
return view('fresh', compact('images'));
}
示例4: images
public function images()
{
$images = Image::latest()->get();
return view('admin.images', compact('images'));
}
示例5: function
|--------------------------------------------------------------------------
*/
Route::get('track', 'WebTrackController@index');
// Sitemap
Route::get('/sitemap', function () {
return Response::view('sitemap')->header('Content-Type', 'application/xml');
});
Route::get('contact', ['as' => 'contact', 'uses' => 'AboutController@create']);
// Email Contact Route
Route::post('contact', ['as' => 'contact_store', 'uses' => 'AboutController@store']);
// Main index route
Route::get("/", function () {
return view('pages.index');
});
Route::get("theatre", function () {
$photo = \App\Image::latest()->take(1)->lists('url');
return view('images.theatre')->with('photo', $photo);
});
/*
|-------------------------------------------------------------------------
| App Routes
|--------------------------------------------------------------------------
*/
// Blog Routes
Route::get('post', 'PostController@index');
Route::get('admin/post', 'PostController@index');
Route::get('Cat-Gifs', 'ImageController@index');
Route::get('Cat-Gifs/{id}', 'ImageController@show');
Route::get('Cat-Gifs/{id}/embed', 'ImageController@embed');
Route::get('api/posts', function () {
$posts = \App\Post::latest()->get();
示例6: get_recently_added_pictures
public function get_recently_added_pictures()
{
$new_pictures = Image::latest('created_at')->Where('created_at', '>', Carbon::now()->subDays(30))->take(11)->get();
return $new_pictures;
}
示例7: imagesWidget
function imagesWidget($min)
{
$entry = Cache::remember('images', $min, function () {
return \App\Image::latest('published_at')->select('images', 'img_title')->first();
});
return $entry;
}
示例8: getPaginateAllImages
public function getPaginateAllImages($val)
{
return Image::latest()->paginate($val);
}