/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $randomAuctions = Auction::getRandomAuctions(4); $auction = Auction::findOrFail($id); $bids = $auction->bids(); // return $bids; return view('detail', compact('auction', 'bids', 'randomAuctions')); }
/** * Bootstrap any application services. * * @return void */ public function boot() { $hotRandomAuction = Auction::getRandomAuctions(1)[0]; view()->share('hotRandomAuction', $hotRandomAuction); }
<?php use App\Auction; /* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the controller to call when that URI is requested. | */ Route::get('/', ['as' => 'home', function () { $sliderAuctions = Auction::getRandomAuctions(4); $popularAuctions = Auction::getRandomAuctions(3); return view('home', compact('sliderAuctions', 'popularAuctions')); }]); // FAQ Route::get('/faq', ['as' => 'faq.index', 'uses' => 'FaqController@index']); // Contact Route::get('contact/{auctionid?}', ['as' => 'contact.index', 'uses' => 'ContactController@index']); Route::post('contact', ['as' => 'contact.send', 'uses' => 'ContactController@send']); // Auth Route::get('/register', ['as' => 'getRegister', 'uses' => 'Auth\\AuthController@getRegister']); Route::post('/register', ['as' => 'postRegister', 'uses' => 'Auth\\AuthController@postRegister']); Route::post('/login', ['as' => 'postLogin', 'uses' => 'Auth\\AuthController@postLogin']); Route::get('/logout', ['as' => 'getLogout', 'uses' => 'Auth\\AuthController@getLogout']); // Art Route::get('/art', ['as' => 'art.index', 'uses' => 'ArtController@index']); Route::get('/art/{id}', ['as' => 'art.show', 'uses' => 'ArtController@show']);