public static function slide($n = 5) { $gal = Gallery::where('title_en', '=', 'slider')->where('slug', '=', 'slider')->first(); // dd($gal); if (!$gal) { return []; } return $gal->media()->orderBy('created_at', 'DESC')->limit($n)->get(); }
Route::resource('services', 'ServicesController'); /** * * Static page */ $router->get('/page/{spage}', ['uses' => 'StaticPageController@index', 'as' => 'static-page']); $router->bind('spage', function ($slug) { return \App\Models\StaticPage::where('slug', '=', $slug)->firstOrFail(); }); /** * * Gallery */ $router->get('/gallery/{gslug}', ['uses' => 'GalleryController@index', 'as' => 'gallery.index']); $router->bind('gslug', function ($slug) { return \App\Models\Gallery::where('slug', '=', $slug)->firstOrFail(); }); /** ADMIN */ $router->get('/admin', function () { return \Illuminate\Support\Facades\Redirect::route('admin.dashboard.index'); }); $router->bind('banner', function ($id) { return App\Models\Banner::find($id); }); $router->bind('services', function ($id) { return App\Models\Services::find($id); }); Route::get('/ipn', 'ZaLaravel\\LaravelPayeer\\Controllers\\IpnPayeerController@getResult'); $router->group(['namespace' => 'AdminControllers', 'prefix' => 'admin', 'middleware' => 'admin'], function ($router) { Route::resource('catshop', 'AdminShopCategoriesController'); Route::resource('shops', 'AdminShopsController');
/** * Display a listing of the resource. * * @return Response */ public function index() { $galleries = Gallery::where('id', '!=', 1)->orderBy('created_at', 'DESC')->paginate(10); return view('galleries.index', compact('galleries')); }