I have a datatable using yajrabox package with links to various strings. When I click on a link, it takes me to a 404 page with "/teams/"string". How do I make this string a viewable page? I have tried using a slug, but I could be using it incorrectly and honestly I don't know where my error is. Here is the impt. parts of my code:
Route:
Route::get('/teams/display/{$slug}', 'TeamsController@display');
TeamsController:
public function display($slug)
{
$teamdatas = LoserData::findBySlugOrFail($slug);
return view('teams/display', compact('teamdatas'));
}
DataTable.blade
{data: 'homeTeam', name: 'homeTeam', "fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {
$(nTd).html("<a href=/teams/display/"+oData.homeTeam+">"+oData.homeTeam+"</a>");
}},
teams/display.blade.php
<div class="container">
<div class="row">
<div class="col-sm-8">
<h1> Welcome the {{$teamdatas->slug}} profile page</h1>
</div>
</div>