Reputation: 4275
Im having this fatal error exception that i cant seem to figure out:
Class 'App\Http\Controllers\Admin\Controller' not found
For some reason im not sure why it is tacking controller at the end of that error. My namespace for the controller:
namespace App\Http\Controllers\Admin;
use Illuminate\Http\Request;
use App\Announcement;
use App\Http\Requests;
class AnnouncementController extends Controller
{
...
}
and my routes:
Route::group(['prefix' => 'admin','namespace'=>'Admin', 'middleware'=>'auth'], function () {
Route::resource('announcements','AnnouncementController');
});
But when i navigate to the /admin/announcements
route i get that fatal exception with the Controller tacked on at the end..
This controller is in the App\Http\Controllers\Admin
directory so i m not sure why i m getting this error. Am i name spacing wrong?
Upvotes: 0
Views: 1009
Reputation: 6279
Try this
Route
Route::group(['prefix' => 'admin', 'middleware'=>'auth'], function () {
Route::resource('announcements','Admin\\AnnouncementController');
});
Controller
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Announcement;
use App\Http\Requests;
class AnnouncementController extends Controller
{
...
}
if this dosent work, check if you have a Controller called Controller in app/Http/Controllers/
Upvotes: 1