In blade I have a list of books. I want to choose a specific book to show its information. And to do so I want to send with href the id of the book to my controller passing through route.
For example i have
<div class="body text-center">
<a href="{{HERE!}}"><h6><b>{{($book->getName())}}</b></h6></a>
</div>
In href I want to add $bookId = $book->id and the route name so I can call the route with the specific name which calls a method in a controller which can use the variable $bookId
Route::get('/infromation','Books\BookController@index')->name('info');
Here's two propositions:
The slug will be generated automatically from
namewhen the book is created.your-migration.php
web.php
Book.php
BookController.php
index.blade.php
I wouldn't recommend using this for the user experience.
web.php
BookController.php
index.blade.php
You can remove the default button style to make it looks like a link https://stackoverflow.com/a/45890842/8068675