Skip to content

Updated event management functionality #92

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: components
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions app/Http/Controllers/AttendanceController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;

class AttendanceController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
//
}

/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}

/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}

/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}

/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}

/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}

/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}
77 changes: 77 additions & 0 deletions app/Http/Controllers/EventController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Models\Event;

class EventController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
$events = Event::all();
return view('events.index', compact('events'));
}

/**
* Show the form for creating a new resource.
*/
public function create()
{
return view('events.create');
}

/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
$validated = $request->validate([
'title' => 'required|string|max:255',
'description' => 'required|string',
'start_time' => 'required|date',
'end_time' => 'required|date|after:start_time',
'location' => 'required|string|max:255',
]);

\App\Models\Event::create($validated);

return redirect()->route('events.index')->with('success', 'Event created successfully!');
}

/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}

/**
* Show the form for editing the specified resource.
*/
public function edit(string $id)
{
//
}

/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}

/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}
13 changes: 13 additions & 0 deletions app/Livewire/Attendance/AttendanceList.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace App\Livewire\Attendance;

use Livewire\Component;

class AttendanceList extends Component
{
public function render()
{
return view('livewire.attendance.attendance-list');
}
}
13 changes: 13 additions & 0 deletions app/Livewire/Events/EventForm.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace App\Livewire\Events;

use Livewire\Component;

class EventForm extends Component
{
public function render()
{
return view('livewire.events.event-form');
}
}
13 changes: 13 additions & 0 deletions app/Livewire/Events/EventList.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace App\Livewire\Events;

use Livewire\Component;

class EventList extends Component
{
public function render()
{
return view('livewire.events.event-list');
}
}
10 changes: 10 additions & 0 deletions app/Models/Attendance.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Attendance extends Model
{
//
}
31 changes: 31 additions & 0 deletions app/Models/Event.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Event extends Model
{
use HasFactory;

protected $fillable = [
'title',
'description',
'start_time',
'end_time',
'location',
];

protected $casts = [
'start_time' => 'datetime',
'end_time' => 'datetime',
];

public function attendees()
{
return $this->belongsToMany(User::class, 'event_attendees')
->withTimestamps()
->withPivot('attendance_status', 'check_in_time');
}
}
Loading