@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | use BristolSU\Module\UploadFile\Models\File; |
| 4 | 4 | use Faker\Generator as Faker; |
| 5 | 5 | |
| 6 | -$factory->define(File::class, function (Faker $faker) { |
|
| 6 | +$factory->define(File::class, function(Faker $faker) { |
|
| 7 | 7 | return [ |
| 8 | 8 | 'title' => $faker->sentence, |
| 9 | 9 | 'description' => $faker->sentence, |
@@ -14,10 +14,10 @@ discard block |
||
| 14 | 14 | 'uploaded_by' => function() { |
| 15 | 15 | return factory(\BristolSU\ControlDB\Models\User::class)->create()->id(); |
| 16 | 16 | }, |
| 17 | - 'module_instance_id' => function () { |
|
| 17 | + 'module_instance_id' => function() { |
|
| 18 | 18 | return factory(\BristolSU\Support\ModuleInstance\ModuleInstance::class)->create()->id; |
| 19 | 19 | }, |
| 20 | - 'activity_instance_id' => function () { |
|
| 20 | + 'activity_instance_id' => function() { |
|
| 21 | 21 | return factory(\BristolSU\Support\ActivityInstance\ActivityInstance::class)->create()->id; |
| 22 | 22 | }, |
| 23 | 23 | 'tags' => $faker->randomElements(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'], 4) |
@@ -256,7 +256,7 @@ |
||
| 256 | 256 | )->withField( |
| 257 | 257 | Field::checkList('allowed_extensions')->label('Allowed file types')->hint('Which file types can be uploaded?') |
| 258 | 258 | ->listBox(true)->values($this->app['config']->get($this->alias() . '.file_types')) |
| 259 | - ->default(['doc', 'docx', 'odt', 'rtf', 'txt', 'csv', 'ppt', 'pptx', 'pdf', 'xls']) |
|
| 259 | + ->default(['doc', 'docx', 'odt', 'rtf', 'txt', 'csv', 'ppt', 'pptx', 'pdf', 'xls']) |
|
| 260 | 260 | ) |
| 261 | 261 | )->withGroup( |
| 262 | 262 | Group::make('Status Changes')->withField( |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | |
| 193 | 193 | public function baseDirectory() |
| 194 | 194 | { |
| 195 | - return __DIR__ . '/..'; |
|
| 195 | + return __DIR__.'/..'; |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | public function register() |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | |
| 216 | 216 | Route::bind('uploadfile_file', function($id) { |
| 217 | 217 | $file = File::findOrFail($id); |
| 218 | - if(request()->route('module_instance_slug') && (int) $file->module_instance_id === request()->route('module_instance_slug')->id()) { |
|
| 218 | + if (request()->route('module_instance_slug') && (int) $file->module_instance_id === request()->route('module_instance_slug')->id()) { |
|
| 219 | 219 | return $file; |
| 220 | 220 | } |
| 221 | 221 | throw (new ModelNotFoundException)->setModel(File::class); |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | |
| 224 | 224 | Route::bind('uploadfile_file_status', function($id) { |
| 225 | 225 | $fileStatus = FileStatus::findOrFail($id); |
| 226 | - if(request()->route('module_instance_slug') && (int) $fileStatus->file->module_instance_id === request()->route('module_instance_slug')->id()) { |
|
| 226 | + if (request()->route('module_instance_slug') && (int) $fileStatus->file->module_instance_id === request()->route('module_instance_slug')->id()) { |
|
| 227 | 227 | return $fileStatus; |
| 228 | 228 | } |
| 229 | 229 | throw (new ModelNotFoundException)->setModel(FileStatus::class); |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | |
| 232 | 232 | Route::bind('uploadfile_comment', function($id) { |
| 233 | 233 | $comment = Comment::findOrFail($id); |
| 234 | - if(request()->route('module_instance_slug') && (int) $comment->file->module_instance_id === request()->route('module_instance_slug')->id()) { |
|
| 234 | + if (request()->route('module_instance_slug') && (int) $comment->file->module_instance_id === request()->route('module_instance_slug')->id()) { |
|
| 235 | 235 | return $comment; |
| 236 | 236 | } |
| 237 | 237 | throw (new ModelNotFoundException)->setModel(Comment::class); |
@@ -251,20 +251,20 @@ discard block |
||
| 251 | 251 | Group::make('New Documents')->withField( |
| 252 | 252 | Field::input('document_title')->inputType('text')->label('Default document title')->hint('This will be the default title of a new file')->default('Document') |
| 253 | 253 | )->withField( |
| 254 | - Field::switch('multiple_files')->label('Multiple Files')->hint('Should multiple files be able to be uploaded at the same time?') |
|
| 254 | + Field::switch ('multiple_files')->label('Multiple Files')->hint('Should multiple files be able to be uploaded at the same time?') |
|
| 255 | 255 | ->textOn('Allow')->textOff('Do not allow')->default(true) |
| 256 | 256 | )->withField( |
| 257 | 257 | Field::checkList('allowed_extensions')->label('Allowed file types')->hint('Which file types can be uploaded?') |
| 258 | - ->listBox(true)->values($this->app['config']->get($this->alias() . '.file_types')) |
|
| 258 | + ->listBox(true)->values($this->app['config']->get($this->alias().'.file_types')) |
|
| 259 | 259 | ->default(['doc', 'docx', 'odt', 'rtf', 'txt', 'csv', 'ppt', 'pptx', 'pdf', 'xls']) |
| 260 | 260 | ) |
| 261 | 261 | )->withGroup( |
| 262 | 262 | Group::make('Status Changes')->withField( |
| 263 | 263 | Field::input('initial_status')->inputType('select')->label('Initial Status')->hint('What status should all new files have?') |
| 264 | - ->default('Awaiting Approval')->values($this->app['config']->get($this->alias() . '.statuses')) |
|
| 264 | + ->default('Awaiting Approval')->values($this->app['config']->get($this->alias().'.statuses')) |
|
| 265 | 265 | )->withField( |
| 266 | 266 | Field::checkList('statuses')->label('Available Statuses')->hint('A list of available statuses') |
| 267 | - ->listBox(true)->values($this->app['config']->get($this->alias() . '.statuses')) |
|
| 267 | + ->listBox(true)->values($this->app['config']->get($this->alias().'.statuses')) |
|
| 268 | 268 | ) |
| 269 | 269 | )->withGroup( |
| 270 | 270 | Group::make('Tags')->withField( |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | return $activityInstance->id; |
| 54 | 54 | }); |
| 55 | 55 | return $query->whereIn('activity_instance_id', $activityInstanceIds->toArray()) |
| 56 | - ->where('tags', 'LIKE', '%"' . $tag . '"%'); |
|
| 56 | + ->where('tags', 'LIKE', '%"'.$tag.'"%'); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -79,12 +79,12 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | public function getStatusAttribute() |
| 81 | 81 | { |
| 82 | - if($this->statuses()->count() > 0) { |
|
| 82 | + if ($this->statuses()->count() > 0) { |
|
| 83 | 83 | return $this->statuses()->latest('created_at')->first()->status; |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | $statuses = Config::get('uploadfile.statuses'); |
| 87 | - if(!is_array($statuses) || count($statuses) === 0) { |
|
| 87 | + if (!is_array($statuses) || count($statuses) === 0) { |
|
| 88 | 88 | $default = 'Awaiting Approval'; |
| 89 | 89 | } else { |
| 90 | 90 | $default = $statuses[0]; |
@@ -10,8 +10,8 @@ |
||
| 10 | 10 | public function index() |
| 11 | 11 | { |
| 12 | 12 | $files = collect(); |
| 13 | - foreach(settings('tags_to_merge', []) as $tag) { |
|
| 14 | - foreach(File::withTag($tag)->get() as $file) { |
|
| 13 | + foreach (settings('tags_to_merge', []) as $tag) { |
|
| 14 | + foreach (File::withTag($tag)->get() as $file) { |
|
| 15 | 15 | $files->push($file); |
| 16 | 16 | } |
| 17 | 17 | } |