-
-
Notifications
You must be signed in to change notification settings - Fork 838
Description
If we are using multiple prefix's on both new and old models we should probably figure out what items can be shared and what items need to be separate. So far I have one setup with the following but would like to know what you guys think.
Shared
- models
- repositories
- functions.php / helpers.php
Not Shared
- controllers
- requests
- fields_file
- {prefixed}public/assets
- {prefixed}/layouts/*
I am starting to think It might help if we have 3 or 4 prefix options instead of 2 but i am still trying to work it out and have not been able to yet.
1- RoutePrefix
2- PathPrefix
3- ViewsPrefix
maybe even a forth for
4- PublicPrefix
This way even if all of the prefixes are not used they can default to the main prefix:
**prefix = admin would be all 4 unless otherwise specified. **
then you could seperate all of the part into assignable options.
example: for public you could have themes and can switch from one to another using this convention.
Or maybe have the layouts assigned in the controller so the route pulls the right views when directed.
_example blog with layouts selected in controller:_
public function index(Request $request)
{
$tag = $request->get('tag');
$data = $this->dispatch(new BlogIndexData($tag));
$layout = $tag ? Tag::layout($tag) : 'blog.layouts.index';
return view($layout, $data);
}
public function showPost($slug, Request $request)
{
$post = Post::with('tags')->whereSlug($slug)->firstOrFail();
$tag = $request->get('tag');
if ($tag) {
$tag = Tag::whereTag($tag)->firstOrFail();
}
return view($post->layout, compact('post', 'tag'));
}