
Step 1.Create a Database in phpMyAdmin.
(Write the same name of database which was written in .enf databse name).

Step 2. We use the migrate command to create the column in the database.
$php artisan migrate

Step 3. Create Controller with methods.
On this step, we want to make a new controller for Event Calendar operations in Laravel Application. After creating a controller file we need to define a method and handling function in it.
namespace App\Http\Controllers; | |
use Illuminate\Http\Request; | |
use App\Event; | |
use MaddHatter\LaravelFullcalendar\Facades\Calendar; | |
use DB; | |
use Illuminate\Support\Facades\Redirect; | |
class EventController extends Controller | |
{ | |
/** | |
* Display a listing of the resource. | |
* | |
* @return \Illuminate\Http\Response | |
*/ | |
public function index() | |
{ | |
$events = []; | |
$data = Event::all(); | |
if($data->count()) | |
{ | |
foreach ($data as $key => $value) | |
{ | |
$events[] = Calendar::event( | |
$value->title, | |
true, | |
new \DateTime($value->start_date), | |
new \DateTime($value->end_date.'+1 day'), | |
null, | |
// Add color | |
[ | |
'color'=> $value->color, | |
'textColor' => $value->textColor, | |
] | |
); | |
} | |
} | |
$calendar =\Calendar::addEvents($events); | |
return view('eventpage',compact('events','calendar')); | |
} | |
/** | |
* Show the form for creating a new resource. | |
* | |
* @return \Illuminate\Http\Response | |
*/ | |
public function display() | |
{ | |
return view("addevent"); | |
} | |
public function create() | |
{ | |
// | |
} | |
public function store(Request $request) | |
{ | |
$request->validate([ | |
'title'=>'required', | |
'color'=>'required', | |
'start_date'=>'required', | |
'end_date'=>'required', | |
]); | |
$events=new Event; | |
$events->title=$request->input('title'); | |
$events->color=$request->input('color'); | |
$events->start_date=$request->input('start_date'); | |
$events->end_date=$request->input('end_date'); | |
$events->save(); | |
return redirect('eventpage')->with('success','Event Added'); | |
} | |
public function show() | |
{ | |
$events = Event::all(); | |
return view('display')->with('events',$events); | |
} | |
public function edit($id) | |
{ | |
$events = Event::find($id); | |
return view('editform',compact('events','id')); | |
} | |
public function update(Request $request, $id) | |
{ | |
$events = Event::where('id', '=', $id)->first(); | |
$events->update($request->all()); | |
return redirect('eventpage')->with('success','Event Updates Successfully'); | |
} | |
/** | |
* Remove the specified resource from storage. | |
* | |
* @param int $id | |
* @return \Illuminate\Http\Response | |
*/ | |
public function destroy($id) | |
{ | |
$events = Event::find($id); | |
$events->delete(); | |
return redirect('/editeventurl'); | |
} | |
} |

Store function is used to store the data.


Destroy function is used for delete the data

In Part 4, we will see how to make blade.php file?
Click Here β https://www.devopsschool.com/blog/how-to-create-event-calendar-in-laravel-part-4/



Iβm a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I am working at Cotocus. I blog tech insights at DevOps School, travel stories at Holiday Landmark, stock market tips at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at I reviewed , and SEO strategies at Wizbrand.
Please find my social handles as below;
Rajesh Kumar Personal Website
Rajesh Kumar at YOUTUBE
Rajesh Kumar at INSTAGRAM
Rajesh Kumar at X
Rajesh Kumar at FACEBOOK
Rajesh Kumar at LINKEDIN
Rajesh Kumar at PINTEREST
Rajesh Kumar at QUORA
Rajesh Kumar at WIZBRAND