V4n1ll4 V4n1ll4 - 8 months ago 153
PHP Question

ReflectionException Class App\Http\Controllers\AdminBookingsController does not exist Laravel-5

I'm trying to load a calendar on my page using AJAX/Laravel-5. The URL the AJAX is posting to exists in my

file. However for some reason I keep getting the following error:

Class App\Http\Controllers\AdminBookingsController does not exist

My jQuery call:

$.fn.initCalendar = function(token,month,location) {
url: '/admin/reports/bookings/butchers',
type: 'post',
data: {
_token: token,
month: month,
location_id: location
dataType: 'json',
success: function(json) {
if(json['error']) {

$(document).ready(function() {

My routes.php file:

Route::post('admin/reports/bookings/butchers', 'AdminBookingsController@genButchersReport');

My controller file:


namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\Booking;
use App\Location;
use App\ClassType;
use App\Classes;
use App\Http\Requests\BookingSearchRequest;
use App\Http\Requests\UpdateBookingRequest;
use App\Http\Requests\BookingReportAccountsRequest;
use Response;
use Excel;
use DB;

class AdminBookingsController extends Controller
* Generate booking report for butchers.
* @return Response
public function genButchersReport()
echo "Hi!...";exit;

I have tried running
composer dump-autoload
but this does not seem to have any effect on the error.

Please help.


I managed to resolve this as my controller was inside a sub folder. I changed my route and now it works.

Route::post('admin/reports/bookings/butchers', 'Admin\AdminBookingsController@genButchersReport');