You Only have the extra vendor Dir when using the workbench. When they are actual packages, you only have the main vendor Dir.
barryvdh said:
You Only have the extra vendor Dir when using the workbench. When they are actual packages, you only have the main vendor Dir.
Interesting. So you say I can just create "packages" without the workbench in a specific directory structure and create routes for it? Architecturally speaking I want to split my application parts in seperate directories with their own controllers and views. I would like to separate models in again another directory, because they are application wide.
Solved it for now by creating my own directory structure in the directory ./modules and using this in composer.json:
"psr-0": {
"Articles": "modules/"
}
inside the "autoload": { part. So my structure is as following:
mylaravelproject
- modules
- Articles
- *othermodules
The PSR-0 autoloader looks for classes inside ./modules/Articles. The namespace to use in the Articles directory is:
namespace Articles;
Yes and you can also register extra view namespaces for different directories, for your blade templates.
Also not bad to mention is that when you need to extend the controller you need the \ (backslash).
class MyNiceClass extends \BaseController
{
public function test()
{
echo \Input::get('name');
}
}
Pay attention to the \ before Input.
Yes, but that's only need when you are in a namespace. Classes with a \ are absolute, others are relative. But you can also add use BaseController
on top of your class, then you don't need the \
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community