Posts

Showing posts with the label laravel-blade

Trouble getting $id from session in laravel

Trouble getting $id from session in laravel I am trying to pass on the value $id through my href to the next page Route: Route::get('/offer-me/{id}', 'OffersController@create')->name('project.detailed'); From View: <a href="{{ route('project.detailed', [$product->id]) }}"><button class="btn btn-success">View</button></p></a> When I go to localhost/projectp0/public/offer-me/2 .... There is no $id value? {"_token":"dSxgM8wTlpNxhDKsqj713KMy656bg8XAU5Q2sqe4","_previous":{"url":"http://localhost/projectp0/public/auction"},"_flash":{"old":,"new":},"login_web_59ba36addc2b2f9401580f014c7f58ea4e30989d":1} To get that view i Run: $data = session()->all(); return($data) What is your use case? That could be helpful to get you a proper solution/alternative. – HCK ...

Passing {id} when button is clicked

Passing {id} when button is clicked I have setup a controller - product which allows me to look up a product url.com/product/{id} When I click a button on the product page. say, to add to cart which takes me to another page. What is the best way to pass on this {id}. Becuase then I want to reference this $id in a controller to look up pricing via . $price = Prices::where('id',$id) $price = Prices::where('id',$id) Is this a good method? Route::get('/prices/{id}', 'PriceController@lookup'); Route::get('/prices/{id}', 'PriceController@lookup'); then <a href="/make-offer/{{$listings->id}}"><button class="btn btn-success">View Price</button></a> Only issue with this is I get Missing required parameters for [Route: ] [URI:/prices/{id} check whether $listings->id is empty. or $listings is a collection? – ab_ab Jul 1 at 12:01 ...