Reputation: 799
I'm in developing of a new package in laravel5. At least my structure looks quite the same as here: https://github.com/cviebrock/laravel5-package-template
The problem occurs in the package controllers when I'm trying to extend from 'App\Http\Controllers\Controller' or set the alias of this class with 'use'. Here I'm always getting errors that the class "Controller" is not found.
I've setup my application in a different namingspace than "App", at my point MyCoolApp for example. So when I'm using 'MyCoolApp\Http\Controllers\Controller' it works, but that could not be the solution for an OpenSource package.
How can I reference to the the App-Controllers within the Namingspace without using 'App' or any other application-namingspace-string?
Upvotes: 0
Views: 44
Reputation: 975
I don't know the reason why you want to extend App\Http\Controllers\Controller
because it's specified for each Project and its behaviour could be changed because of setting in each Application.
I also take a look at App\Http\Controllers\Controller
.
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
abstract class Controller extends BaseController
{
use DispatchesJobs, ValidatesRequests;
}
I think you should extends Illuminate\Routing\Controller
instead.
Upvotes: 1