diff --git a/app/Http/Controllers/AppointmentController.php b/app/Http/Controllers/AppointmentController.php index 662f2a0..1a97819 100644 --- a/app/Http/Controllers/AppointmentController.php +++ b/app/Http/Controllers/AppointmentController.php @@ -67,7 +67,6 @@ class AppointmentController extends Controller public function updateAppointment(Request $request, $applicationID, $status) { - $this->authorize('update', Appointment::class); $application = Application::find($applicationID); $validStatuses = [ @@ -75,6 +74,9 @@ class AppointmentController extends Controller 'CONCLUDED' ]; + $this->authorize('update', $application->appointment); + + if (!is_null($application)) { diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 7d3a4b8..52563b4 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -2,15 +2,15 @@ namespace App\Providers; -use App\Http\Controllers\BanController; -use App\Http\Controllers\VoteController; -use App\Http\Controllers\ProfileController; -use App\Http\Controllers\AppointmentController; use App\Policies\ProfilePolicy; use App\Policies\VacancyPolicy; use App\Policies\UserPolicy; +use App\Policies\BanPolicy; use App\Policies\FormPolicy; +use App\Policies\VotePolicy; use App\Policies\ApplicationPolicy; +use App\Policies\AppointmentPolicy; + use App\User; use App\Form; use App\Vote; @@ -18,6 +18,8 @@ use App\Vacancy; use App\Application; use App\Appointment; use App\Ban; + + use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; use Illuminate\Support\Facades\Gate; @@ -36,9 +38,9 @@ class AuthServiceProvider extends ServiceProvider Vacancy::class => VacancyPolicy::class, //Form::class => FormPolicy::class 'App\Form' => 'App\Policies\FormPolicy', - Vote::class => VoteController::class, - Ban::class => BanController::class, - Appointment::class => AppointmentController::class + Vote::class => VotePolicy::class, + Ban::class => BanPolicy::class, + Appointment::class => AppointmentPolicy::class ]; /**