Code: Select all
@foreach($recentPost as $recent)
<div class="col-md-6">
<div class="indi-news-highlight-box">
<a href="{!! route('getArticle' , ['id' => $recent->id ]) !!}">
<img src="{{ URL::asset('images/temp/blog-post-image.jpg') }}" alt="{!! $recent->title !!}">
</a>
<div class="content-box">
<h3>
<a href="{!! route('getArticle' , ['id' => $recent->id ]) !!}">
{{ $recent->title }}
</a>
</h3>
<p>
{{ $recent->blog_content }}
</p>
</div>
</div>
</div> <!-- End col-md-6 -->
@endForEach
so i have the following route in my route file:
Code: Select all
Route::get('/{id}' , [
'uses' => 'PagesController@show',
'as' => 'getArticle'
]);
Code: Select all
public function show($id) {
return view('pages.article' , ['article' => Admin::findOrFail($id)]);
}
http://localhost:8080/laravel-blog/public/6
http://localhost:8080/laravel-blog/public/1
and so on.. but what i really want is the slug of the article , so say the article title is 'firefox browser bug' ,
i want the url to be:
http://localhost:8080/laravel-blog/publ ... rowser-bug
How do i do this ??
Thank you.
Gautam.