Skip to content

Prefix Options #155

@phillipmadsen

Description

@phillipmadsen

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'));
  }

As of right know that Is all I have been working on but by all means lets collaborate.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions