39 lines
1.2 KiB
PHP
39 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Staff;
|
|
|
|
use App\Http\Controllers\HashidControllerBase;
|
|
use App\Http\Requests\StudyHistoryRequest;
|
|
use App\Models\Enums\Permission;
|
|
use App\Models\StudyDetails;
|
|
|
|
class StudyHistoryController extends HashidControllerBase
|
|
{
|
|
public function view()
|
|
{
|
|
abort_unless(auth()->user()->can(Permission::StudyHistoryView) || auth()->user()->isAdmin(), 403);
|
|
$this->decodeKeys();
|
|
$details = StudyDetails::where('study_id', $this->key)->first();
|
|
|
|
return view('staff.history.view', compact('details'));
|
|
}
|
|
|
|
public function edit()
|
|
{
|
|
abort_unless(auth()->user()->can(Permission::StudyHistoryEdit) || auth()->user()->isAdmin(), 403);
|
|
$this->decodeKeys();
|
|
$details = StudyDetails::where('study_id', $this->key)->first();
|
|
|
|
return view('staff.history.edit', compact('details'));
|
|
}
|
|
|
|
public function save(StudyHistoryRequest $request)
|
|
{
|
|
abort_unless(auth()->user()->can(Permission::StudyHistoryEdit) || auth()->user()->isAdmin(), 403);
|
|
$this->decodeKeys();
|
|
$details = StudyDetails::where('study_id', $this->key)->first();
|
|
|
|
return redirect()->route('staff.history.show', $this->key);
|
|
}
|
|
}
|