LAR_Maintenance/app/Http/Controllers/MaintenanceController.php
2024-08-08 10:33:21 +02:00

57 lines
1.4 KiB
PHP

<?php
namespace App\Http\Controllers;
use App\Models\MaintenanceHistory;
use Carbon\Carbon;
use Illuminate\Http\Request;
class MaintenanceController extends BaseController
{
public function index()
{
return view('maintenance.index');
}
public function planned()
{
return view('maintenance.planned');
}
public function plannedDetail(MaintenanceHistory $maintenance_history)
{
if (!empty($maintenance_history->finished_at)){
abort(404);
}
return view('maintenance.planned-detail', [
'maintenance_history' => $maintenance_history,
]);
}
public function plannedDetailPut(Request $request, MaintenanceHistory $maintenance_history)
{
if (!empty($maintenance_history->finished_at)){
abort(404);
}
$maintenance_history->finished_at = Carbon::now();
$maintenance_history->save();
return view('maintenance.planned-detail-done', [
'maintenance_history' => $maintenance_history,
'maintenance_task_status' => $request->input('maintenance_task_status'),
]);
}
public function plannedDetailFinishPost(Request $request, MaintenanceHistory $maintenance_history)
{
dd();
}
public function history(Request $request, MaintenanceHistory $maintenance_history)
{
return view('maintenance.history');
}
}