While creating a basic item detail page for a basic blog I've run into a problem with Laravel's @extends not working when pulling in a master layout template. The content from the detail page loads just fine but the master page HTML is not there at all and I'm not getting any errors.
In my routes:
Route::get('blog', 'BlogController@public_index');
Route::get('blog/{id}', 'BlogController@public_single');
In my BlogController:
public function public_single($id) {
$blog = Blog::find($id);
return View::make('public.blog_single') -> with('blog', $blog);
}
At the very top of the blog_single template:
@extends('layouts.public')
All other templates that use this master layout work as expected.
My views directory structure:
views
|
|layouts
| |
| | admin.blade.php
| | public.blade.php
|
|public
|
|blog.blade.php
|blog_single.blade.php
One thing I'm wondering is if the fact that this page looks like it's rendering from a subdirectory is an issue. Here is an example:
This works:
www.mydomain.com/blog
This doesn't:
www.mydomain.com/blog/1
I've looked through the Laravel docs and don't see an answer there. Any ideas? Thanks.
Route::get('blog', 'aControler');
? – FractalisteAll other templates that use this master layout work as expected
, so what is the difference between this (blog_single
) and other views ? – The Alpha