Files
LauckCycles/app/Http/Controllers/AgendaController.php
T

33 lines
812 B
PHP

<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Appointment;
class AgendaController extends Controller
{
public function index()
{
$all_appointments = Appointment::with('client')->get();
$appointments = [];
foreach($all_appointments as $appointment){
$appointments[] = [
'id' => $appointment->id,
'title' => $appointment->scheduled_at->format('H:i') . ' - ' . $appointment->client->name,
'start' => $appointment->scheduled_at->format('Y-m-d\TH:i:s'),
'extendedProps' => [
'description' => $appointment->problem_description,
'status' => $appointment->status,
],
];
}
return view('agenda', compact('appointments'));
}
}