I'm trying to load a calendar on my page using AJAX/Laravel-5. The URL the AJAX is posting to exists in my routes.php
file. However for some reason I keep getting the following error:
Class App\Http\Controllers\AdminBookingsController does not exist
My jQuery call:
(function($){
$.fn.initCalendar = function(token,month,location) {
$('#calendar-overlay-wrap').html('');
$.ajax({
url: '/admin/reports/bookings/butchers',
type: 'post',
data: {
_token: token,
month: month,
location_id: location
},
dataType: 'json',
success: function(json) {
if(json['error']) {
$('#calendar-overlay-wrap').html(json['msg']);
}
$('#calendar').html(json['calendar']);
}
});
}
})(jQuery);
$(document).ready(function() {
$.fn.initCalendar(
$('input[name=_token]').val(),
$('#month').val(),
$('#location_id').val()
);
});
My routes.php file:
Route::post('admin/reports/bookings/butchers', 'AdminBookingsController@genButchersReport');
My controller file:
<?php
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.