From 6c89f08193b0ec48fa08715b4283dad6de9e1ea0 Mon Sep 17 00:00:00 2001 From: Marcus Moore Date: Tue, 17 Jan 2023 16:59:50 -0800 Subject: [PATCH] Register the accessories.files ability and allow users with the ability to upload files for accessories --- app/Providers/AuthServiceProvider.php | 6 ++++++ resources/views/accessories/view.blade.php | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 41cde07fdc..f18eb2fd36 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -114,6 +114,12 @@ class AuthServiceProvider extends ServiceProvider } }); + Gate::define('accessories.files', function ($user) { + if ($user->hasAccess('accessories.files')) { + return true; + } + }); + Gate::define('components.files', function ($user) { if ($user->hasAccess('components.files')) { return true; diff --git a/resources/views/accessories/view.blade.php b/resources/views/accessories/view.blade.php index 2bccb40a9b..45ffab272d 100644 --- a/resources/views/accessories/view.blade.php +++ b/resources/views/accessories/view.blade.php @@ -84,8 +84,7 @@ @endcan - @can('update', Component::class) - + @can('update', \App\Models\Accessory::class)
  • {{ trans('button.upload') }}