@@ -238,7 +238,7 @@ |
||
| 238 | 238 | )->withField( |
| 239 | 239 | Field::checkList('allowed_extensions')->label('Allowed file types')->hint('Which file types can be uploaded?') |
| 240 | 240 | ->listBox(true)->values($this->app['config']->get($this->alias() . '.file_types')) |
| 241 | - ->default(['doc', 'docx', 'odt', 'rtf', 'txt', 'csv', 'ppt', 'pptx', 'pdf', 'xls']) |
|
| 241 | + ->default(['doc', 'docx', 'odt', 'rtf', 'txt', 'csv', 'ppt', 'pptx', 'pdf', 'xls']) |
|
| 242 | 242 | ) |
| 243 | 243 | )->withGroup( |
| 244 | 244 | Group::make('Status Changes')->withField( |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | public function baseDirectory() |
| 178 | 178 | { |
| 179 | - return __DIR__ . '/..'; |
|
| 179 | + return __DIR__.'/..'; |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | public function register() |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | Route::bind('uploadfile_file', function($id) { |
| 199 | 199 | $file = File::findOrFail($id); |
| 200 | - if(request()->route('module_instance_slug') && (int) $file->module_instance_id === request()->route('module_instance_slug')->id()) { |
|
| 200 | + if (request()->route('module_instance_slug') && (int) $file->module_instance_id === request()->route('module_instance_slug')->id()) { |
|
| 201 | 201 | return $file; |
| 202 | 202 | } |
| 203 | 203 | throw (new ModelNotFoundException)->setModel(File::class); |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | |
| 206 | 206 | Route::bind('uploadfile_file_status', function($id) { |
| 207 | 207 | $fileStatus = FileStatus::findOrFail($id); |
| 208 | - if(request()->route('module_instance_slug') && (int) $fileStatus->file->module_instance_id === request()->route('module_instance_slug')->id()) { |
|
| 208 | + if (request()->route('module_instance_slug') && (int) $fileStatus->file->module_instance_id === request()->route('module_instance_slug')->id()) { |
|
| 209 | 209 | return $fileStatus; |
| 210 | 210 | } |
| 211 | 211 | throw (new ModelNotFoundException)->setModel(FileStatus::class); |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | Route::bind('uploadfile_comment', function($id) { |
| 215 | 215 | $comment = Comment::findOrFail($id); |
| 216 | - if(request()->route('module_instance_slug') && (int) $comment->file->module_instance_id === request()->route('module_instance_slug')->id()) { |
|
| 216 | + if (request()->route('module_instance_slug') && (int) $comment->file->module_instance_id === request()->route('module_instance_slug')->id()) { |
|
| 217 | 217 | return $comment; |
| 218 | 218 | } |
| 219 | 219 | throw (new ModelNotFoundException)->setModel(Comment::class); |
@@ -233,20 +233,20 @@ discard block |
||
| 233 | 233 | Group::make('New Documents')->withField( |
| 234 | 234 | Field::input('document_title')->inputType('text')->label('Default document title')->hint('This will be the default title of a new file')->default('Document') |
| 235 | 235 | )->withField( |
| 236 | - Field::switch('multiple_files')->label('Multiple Files')->hint('Should multiple files be able to be uploaded at the same time?') |
|
| 236 | + Field::switch ('multiple_files')->label('Multiple Files')->hint('Should multiple files be able to be uploaded at the same time?') |
|
| 237 | 237 | ->textOn('Allow')->textOff('Do not allow')->default(true) |
| 238 | 238 | )->withField( |
| 239 | 239 | Field::checkList('allowed_extensions')->label('Allowed file types')->hint('Which file types can be uploaded?') |
| 240 | - ->listBox(true)->values($this->app['config']->get($this->alias() . '.file_types')) |
|
| 240 | + ->listBox(true)->values($this->app['config']->get($this->alias().'.file_types')) |
|
| 241 | 241 | ->default(['doc', 'docx', 'odt', 'rtf', 'txt', 'csv', 'ppt', 'pptx', 'pdf', 'xls']) |
| 242 | 242 | ) |
| 243 | 243 | )->withGroup( |
| 244 | 244 | Group::make('Status Changes')->withField( |
| 245 | 245 | Field::input('initial_status')->inputType('select')->label('Initial Status')->hint('What status should all new files have?') |
| 246 | - ->default('Awaiting Approval')->values($this->app['config']->get($this->alias() . '.statuses')) |
|
| 246 | + ->default('Awaiting Approval')->values($this->app['config']->get($this->alias().'.statuses')) |
|
| 247 | 247 | )->withField( |
| 248 | 248 | Field::checkList('statuses')->label('Available Statuses')->hint('A list of available statuses') |
| 249 | - ->listBox(true)->values($this->app['config']->get($this->alias() . '.statuses')) |
|
| 249 | + ->listBox(true)->values($this->app['config']->get($this->alias().'.statuses')) |
|
| 250 | 250 | ) |
| 251 | 251 | )->getSchema(); |
| 252 | 252 | } |
@@ -52,12 +52,12 @@ |
||
| 52 | 52 | |
| 53 | 53 | public function getStatusAttribute() |
| 54 | 54 | { |
| 55 | - if($this->statuses()->count() > 0) { |
|
| 55 | + if ($this->statuses()->count() > 0) { |
|
| 56 | 56 | return $this->statuses()->latest('created_at')->first()->status; |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | $statuses = Config::get('uploadfile.statuses'); |
| 60 | - if(!is_array($statuses) || count($statuses) === 0) { |
|
| 60 | + if (!is_array($statuses) || count($statuses) === 0) { |
|
| 61 | 61 | $default = 'Awaiting Approval'; |
| 62 | 62 | } else { |
| 63 | 63 | $default = $statuses[0]; |
@@ -19,11 +19,11 @@ |
||
| 19 | 19 | public function percentage($settings, ActivityInstance $activityInstance, ModuleInstance $moduleInstance): int |
| 20 | 20 | { |
| 21 | 21 | $count = File::forResource($activityInstance->id, $moduleInstance->id)->count(); |
| 22 | - $needed = ( $settings['number_of_files'] ?? 1); |
|
| 22 | + $needed = ($settings['number_of_files'] ?? 1); |
|
| 23 | 23 | |
| 24 | - $percentage = (int) round(($count/$needed) * 100, 0); |
|
| 24 | + $percentage = (int) round(($count / $needed) * 100, 0); |
|
| 25 | 25 | |
| 26 | - if($percentage > 100) { |
|
| 26 | + if ($percentage > 100) { |
|
| 27 | 27 | return 100; |
| 28 | 28 | } |
| 29 | 29 | return $percentage; |
@@ -23,11 +23,11 @@ |
||
| 23 | 23 | $count = File::forResource($activityInstance->id, $moduleInstance->id())->get()->filter(function(File $file) use ($settings) { |
| 24 | 24 | return $file->status === $settings['status']; |
| 25 | 25 | })->count(); |
| 26 | - $needed = ( $settings['number_of_files'] ?? 1); |
|
| 26 | + $needed = ($settings['number_of_files'] ?? 1); |
|
| 27 | 27 | |
| 28 | - $percentage = (int) round(($count/$needed) * 100, 0); |
|
| 28 | + $percentage = (int) round(($count / $needed) * 100, 0); |
|
| 29 | 29 | |
| 30 | - if($percentage > 100) { |
|
| 30 | + if ($percentage > 100) { |
|
| 31 | 31 | return 100; |
| 32 | 32 | } |
| 33 | 33 | return $percentage; |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | { |
| 53 | 53 | $this->authorize('file.destroy'); |
| 54 | 54 | |
| 55 | - if((int) $file->activity_instance_id !== (int) app(ActivityInstanceResolver::class)->getActivityInstance()->id) { |
|
| 55 | + if ((int) $file->activity_instance_id !== (int) app(ActivityInstanceResolver::class)->getActivityInstance()->id) { |
|
| 56 | 56 | throw new AuthorizationException(); |
| 57 | 57 | } |
| 58 | 58 | |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | { |
| 69 | 69 | $this->authorize('file.index'); |
| 70 | 70 | |
| 71 | - if((int) $file->activity_instance_id !== (int) app(ActivityInstanceResolver::class)->getActivityInstance()->id) { |
|
| 71 | + if ((int) $file->activity_instance_id !== (int) app(ActivityInstanceResolver::class)->getActivityInstance()->id) { |
|
| 72 | 72 | throw new AuthorizationException(); |
| 73 | 73 | } |
| 74 | 74 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | { |
| 80 | 80 | $this->authorize('file.update'); |
| 81 | 81 | |
| 82 | - if((int) $file->activity_instance_id !== (int) app(ActivityInstanceResolver::class)->getActivityInstance()->id) { |
|
| 82 | + if ((int) $file->activity_instance_id !== (int) app(ActivityInstanceResolver::class)->getActivityInstance()->id) { |
|
| 83 | 83 | throw new AuthorizationException(); |
| 84 | 84 | } |
| 85 | 85 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | public function index(Request $request, Activity $activity, ModuleInstance $moduleInstance, File $file) |
| 22 | 22 | { |
| 23 | 23 | $this->authorize('comment.index'); |
| 24 | - if ((int)$file->activity_instance_id !== (int)app(ActivityInstanceResolver::class)->getActivityInstance()->id) { |
|
| 24 | + if ((int) $file->activity_instance_id !== (int) app(ActivityInstanceResolver::class)->getActivityInstance()->id) { |
|
| 25 | 25 | throw new AuthorizationException(); |
| 26 | 26 | } |
| 27 | 27 | return $file->comments; |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | { |
| 46 | 46 | $this->authorize('comment.destroy'); |
| 47 | 47 | |
| 48 | - if ((int)$comment->file->activity_instance_id !== (int)app(ActivityInstanceResolver::class)->getActivityInstance()->id) { |
|
| 48 | + if ((int) $comment->file->activity_instance_id !== (int) app(ActivityInstanceResolver::class)->getActivityInstance()->id) { |
|
| 49 | 49 | throw new AuthorizationException(); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | { |
| 61 | 61 | $this->authorize('comment.update'); |
| 62 | 62 | |
| 63 | - if ((int)$comment->file->activity_instance_id !== (int)app(ActivityInstanceResolver::class)->getActivityInstance()->id) { |
|
| 63 | + if ((int) $comment->file->activity_instance_id !== (int) app(ActivityInstanceResolver::class)->getActivityInstance()->id) { |
|
| 64 | 64 | throw new AuthorizationException(); |
| 65 | 65 | } |
| 66 | 66 | |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | { |
| 18 | 18 | $this->authorize('file.download'); |
| 19 | 19 | |
| 20 | - if(Storage::exists($file->path)) { |
|
| 20 | + if (Storage::exists($file->path)) { |
|
| 21 | 21 | return Storage::download($file->path, $file->filename); |
| 22 | 22 | } |
| 23 | 23 | |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | { |
| 12 | 12 | $this->authorize('view-page'); |
| 13 | 13 | |
| 14 | - return view(alias() . '::participant'); |
|
| 14 | + return view(alias().'::participant'); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | } |
| 18 | 18 | \ No newline at end of file |
@@ -17,7 +17,7 @@ |
||
| 17 | 17 | public function authorize($ability, $arguments = []) |
| 18 | 18 | { |
| 19 | 19 | return $this->baseAuthorize( |
| 20 | - alias() . '.' . $ability, |
|
| 20 | + alias().'.'.$ability, |
|
| 21 | 21 | $arguments |
| 22 | 22 | ); |
| 23 | 23 | } |