I am having a problem how to display slug data in view file i am using cviebrock/eloquent-sluggable
my model file
use Sluggable;
public function sluggable() {
return ['slug'=>[
'source'=>'title',
'onUpdate'=>true
]];
}
public static function boot()
{
parent::boot();
self::creating(function($model){
$model->slug = Str::slug($model->title, '-');
});
}
my route
Route::get(“tenderview”, “TenderViewController@show”)->name(‘tenderview’);
Route::get(‘/tenderview’, ‘TenderViewController@index’)->name(‘tenderview’);
Controller file
public function index()
{
return view('tenderview');
}
public function show()
{
$dataa = Kind::orderBy('created_at', 'DESC')->paginate(8);
return view('tenderview',['dataa'=>$dataa]);
}
View file
@foreach($dataa as $dater)
{{$dater->name}}
@endforeach
How can i show slug in my view instead of displaying data as a whole, i want to display a link to the actual data. Thank you