Sunday, March 12, 2017

laravel 5.4 how to make page title with dynamic

ihave a route to get artists initial letter.

this is my route

Route::get('/artists/{letter}', 'HomeController@showArtist')->where('letter', '[A-Za-z]+')->name('list');

and this is my controller showArtist method

public function showArtist($letter){
        $artists = Artist::where('name', 'like', $letter.'%')->get();
        return view('front.list',compact('artists'));
    }

what i want is in my list page that lists all artists alphabetically, i have made alphabetical menu like this A B C, FOR example if is clicked it will get all artists with initial letter A.

but my question is how can i make in my page title, foreaxmple like this "Artists begging with letter A" etc.

@section('title', 'artists begging with'. $artist->letter)

my question is how to find letter value?

please help how to accomplish this?



via Mahamoud Mahamed

Advertisement