I am trying to integrate fullcallendar in a laravel10 + Metronic app
helpers.addVendors(['fullcalendar']); called from controller gives error:
Undefined constant "App\Http\Controllers\helpers"
CODE:
<?php
namespace App\Http\Controllers;
use App\Models\User;
use Illuminate\Http\Request;
class CalendarController extends Controller
{
public function index()
{
helpers.addVendors(['fullcalendar']);
return view('pages/calendar')->with(['page'=>'calendar','section'=>'this_month']);
}
}
How to add assets from controller? Documentation isn't that clear.
Thank you.
You should never add assets from your controller. Code you used is not PHP/laravel code, so it won't work.
You should always add assets in your blade file, in this case with script tag like this:
Then you can use fullcalendar as it's official documentation suggests https://fullcalendar.io/docs/initialize-globals