diff --git a/.env.dusk.testing b/.env.dusk.testing index b20d3ca7..fde32134 100644 --- a/.env.dusk.testing +++ b/.env.dusk.testing @@ -9,7 +9,7 @@ DB_DATABASE=jitterbug_testing DB_USERNAME=homestead DB_PASSWORD=secret -CACHE_DRIVER=file +CACHE_STORE=file SESSION_DRIVER=file SESSION_SECURE_COOKIE=false QUEUE_DRIVER=sync diff --git a/.env.example b/.env.example index aec3819b..fc8c1ae4 100644 --- a/.env.example +++ b/.env.example @@ -7,7 +7,7 @@ DB_DATABASE=jitterbug DB_USERNAME=homestead DB_PASSWORD=secret -CACHE_DRIVER=file +CACHE_STORE=file SESSION_DRIVER=file SESSION_SECURE_COOKIE=false QUEUE_DRIVER=sync @@ -25,6 +25,7 @@ SOLR_PATH=/ #LOG_CHANNEL_PATH=/logs/laravel.log #LOG_CHANNEL='single' +LOG_STACK=single #STORAGE_PATH=/opt/laravel/jitterbug @@ -42,4 +43,14 @@ LDAP_LOGGING=true ADMIN_USER_PASSWORD='secret' LDAP_AUTO_CONNECT=false -APP_AUTH=ldap \ No newline at end of file +APP_AUTH=ldap +APP_LOCALE=en +APP_FALLBACK_LOCALE=en +APP_FAKER_LOCALE=en_US +APP_MAINTENANCE_DRIVER=file +APP_MAINTENANCE_STORE=database +BCRYPT_ROUNDS=12 + +SESSION_ENCRYPT=false +SESSION_PATH=/ +SESSION_DOMAIN=null diff --git a/app/Console/Commands/AutoIncrementCollectionIds.php b/app/Console/Commands/AutoIncrementCollectionIds.php index 7635f945..2342559a 100644 --- a/app/Console/Commands/AutoIncrementCollectionIds.php +++ b/app/Console/Commands/AutoIncrementCollectionIds.php @@ -37,7 +37,7 @@ public function __construct() * * @return mixed */ - public function handle() + public function handle(): void { $bar = $this->output->createProgressBar(100); $collections = Collection::withTrashed()->get(); @@ -56,40 +56,42 @@ public function handle() $bar->advance(); $brokenIds = []; DB::table('new_call_number_sequences') - ->whereNotNull('collection_id') - ->chunkById(1000, function ($results) use (&$brokenIds, &$collectionIdMapping, &$bar) { - foreach ($results as $result) { - if (isset($collectionIdMapping[$result->collection_id])) { - $newCollectionId = $collectionIdMapping[$result->collection_id]; - } else { - $brokenIds['sequence_id'] = $result->id; - continue; - } + ->whereNotNull('collection_id') + ->chunkById(1000, function ($results) use (&$brokenIds, &$collectionIdMapping, &$bar) { + foreach ($results as $result) { + if (isset($collectionIdMapping[$result->collection_id])) { + $newCollectionId = $collectionIdMapping[$result->collection_id]; + } else { + $brokenIds['sequence_id'] = $result->id; - DB::table('new_call_number_sequences') - ->where('id', $result->id) - ->update(['collection_id' => $newCollectionId]); - } - $bar->advance(); - }); + continue; + } - DB::table('audio_visual_items') - ->whereNotNull('collection_id') - ->chunkById(1000, function ($results) use (&$brokenIds, &$collectionIdMapping, &$bar) { - foreach ($results as $result) { - if (isset($collectionIdMapping[$result->collection_id])) { - $newCollectionId = $collectionIdMapping[$result->collection_id]; - } else { - $brokenIds['av_item_id'] = $result->id; - continue; + DB::table('new_call_number_sequences') + ->where('id', $result->id) + ->update(['collection_id' => $newCollectionId]); } + $bar->advance(); + }); + + DB::table('audio_visual_items') + ->whereNotNull('collection_id') + ->chunkById(1000, function ($results) use (&$brokenIds, &$collectionIdMapping, &$bar) { + foreach ($results as $result) { + if (isset($collectionIdMapping[$result->collection_id])) { + $newCollectionId = $collectionIdMapping[$result->collection_id]; + } else { + $brokenIds['av_item_id'] = $result->id; + + continue; + } - DB::table('audio_visual_items') - ->where('id', $result->id) - ->update(['collection_id' => $newCollectionId]); - } - $bar->advance(); - }); + DB::table('audio_visual_items') + ->where('id', $result->id) + ->update(['collection_id' => $newCollectionId]); + } + $bar->advance(); + }); $headers = ['table => id']; $this->table($headers, $brokenIds); diff --git a/app/Console/Commands/BackfillImportActions.php b/app/Console/Commands/BackfillImportActions.php index c6a14de8..922d3cb7 100644 --- a/app/Console/Commands/BackfillImportActions.php +++ b/app/Console/Commands/BackfillImportActions.php @@ -37,7 +37,7 @@ public function __construct() * * @return mixed */ - public function handle() + public function handle(): void { $importTransactions = ImportTransaction::all(); $bar = $this->output->createProgressBar($importTransactions->count()); @@ -45,7 +45,7 @@ public function handle() $bar->advance(); // grab revisions related to the import $relatedRevisions = DB::table('revisions') - ->where('transaction_id', $importTransaction->transaction_id)->get(); + ->where('transaction_id', $importTransaction->transaction_id)->get(); // determine unique field values $fields = $relatedRevisions->pluck('field')->unique(); // if any of the fields are created_at, then it's a create, so skip diff --git a/app/Console/Commands/BackfillNewCollectionTypesSequences.php b/app/Console/Commands/BackfillNewCollectionTypesSequences.php index faa036b6..170d8f85 100644 --- a/app/Console/Commands/BackfillNewCollectionTypesSequences.php +++ b/app/Console/Commands/BackfillNewCollectionTypesSequences.php @@ -37,13 +37,13 @@ public function __construct() * * @return mixed */ - public function handle() + public function handle(): void { $collectionTypeId = $this->argument('collection_type_id'); $prefixes = DB::table('prefixes')->select('label') - ->where('collection_type_id', '=', $collectionTypeId) - ->distinct() - ->get(); + ->where('collection_type_id', '=', $collectionTypeId) + ->distinct() + ->get(); $collections = DB::table('collections')->where('collection_type_id', '=', $collectionTypeId)->get(); $bar = $this->output->createProgressBar($collections->count()); @@ -52,12 +52,12 @@ public function handle() $bar->advance(); foreach ($prefixes as $prefix) { $sequenceExists = DB::table('new_call_number_sequences') - ->where('prefix', '=', $prefix->label) - ->where('collection_id', '=', $collection->id) - ->exists(); + ->where('prefix', '=', $prefix->label) + ->where('collection_id', '=', $collection->id) + ->exists(); if (! $sequenceExists) { - $sequence = new NewCallNumberSequence(); + $sequence = new NewCallNumberSequence; $sequence->prefix = $prefix->label; $sequence->collection_id = $collection->id; $sequence->archival_identifier = $collection->archival_identifier; diff --git a/app/Console/Commands/Inspire.php b/app/Console/Commands/Inspire.php index 8b4b1bb9..57e916c7 100644 --- a/app/Console/Commands/Inspire.php +++ b/app/Console/Commands/Inspire.php @@ -26,7 +26,7 @@ class Inspire extends Command * * @return mixed */ - public function handle() + public function handle(): void { $this->comment(PHP_EOL.Inspiring::quote().PHP_EOL); } diff --git a/app/Console/Commands/SetCollectionToLegacyCallNumberSequence.php b/app/Console/Commands/SetCollectionToLegacyCallNumberSequence.php index 2dfdbf0f..565fc58f 100644 --- a/app/Console/Commands/SetCollectionToLegacyCallNumberSequence.php +++ b/app/Console/Commands/SetCollectionToLegacyCallNumberSequence.php @@ -36,21 +36,21 @@ public function __construct() * * @return mixed */ - public function handle() + public function handle(): void { $archivalIdentifier = $this->argument('archival_identifier'); // Find all new call number sequences that have been used and get their associated prefix $usedSequencePrefixes = DB::table('new_call_number_sequences') - ->where('archival_identifier', $archivalIdentifier) - ->where('next', '>', 1) - ->pluck('prefix'); + ->where('archival_identifier', $archivalIdentifier) + ->where('next', '>', 1) + ->pluck('prefix'); // Only delete the new call number sequences that have never been used DB::table('new_call_number_sequences') - ->where('archival_identifier', $archivalIdentifier) - ->where('next', '=', 1) - ->delete(); + ->where('archival_identifier', $archivalIdentifier) + ->where('next', '=', 1) + ->delete(); if ($usedSequencePrefixes->count() > 0) { $this->info('Done! The sequences with the following prefixes were not deleted because they have been used: '.$usedSequencePrefixes); diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php deleted file mode 100644 index 534c20d6..00000000 --- a/app/Console/Kernel.php +++ /dev/null @@ -1,39 +0,0 @@ -load(__DIR__.'/Commands'); - } - - /** - * Define the application's command schedule. - * - * @param \Illuminate\Console\Scheduling\Schedule $schedule - * @return void - */ - protected function schedule(Schedule $schedule) - { - // Generate the activity stream - $schedule->call(function () { - $activityStream = new ActivityStream; - $activityStream->generate(); - })->name('generateActivityStream') - ->everyMinute() - ->timezone('America/New_York') - ->between('7:00', '18:00') - ->withoutOverlapping(15); - } -} diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index b9cf6f03..1533c44b 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -27,7 +27,6 @@ class Handler extends ExceptionHandler * Convert an authentication exception into an unauthenticated response. * * @param \Illuminate\Http\Request $request - * @param \Illuminate\Auth\AuthenticationException $exception * @return \Illuminate\Http\Response */ protected function unauthenticated($request, AuthenticationException $exception) diff --git a/app/Export/InstancesExport.php b/app/Export/InstancesExport.php index 54beeef6..b9ff986c 100644 --- a/app/Export/InstancesExport.php +++ b/app/Export/InstancesExport.php @@ -63,8 +63,8 @@ public function exportableFields() // record types. For example, if all the records are AudioItems, we // don't want to return fields that are specific to film. $types = DB::table('preservation_instances') - ->select(DB::raw('TRIM(TRAILING "Instance" FROM subclass_type) AS type')) - ->whereIn('id', $this->ids)->distinct()->get()->pluck('type'); + ->select(DB::raw('TRIM(TRAILING "Instance" FROM subclass_type) AS type')) + ->whereIn('id', $this->ids)->distinct()->get()->pluck('type'); $fields = []; // Fields at index 0 are intended to be rendered on the left in the // export dialog, and those at index 1 on the right. diff --git a/app/Export/ItemsExport.php b/app/Export/ItemsExport.php index a0c5e752..0f24eadf 100644 --- a/app/Export/ItemsExport.php +++ b/app/Export/ItemsExport.php @@ -76,8 +76,8 @@ public function exportableFields() // record types. For example, if all the records are AudioItems, we // don't want to return fields that are specific to film. $types = DB::table('audio_visual_items') - ->select(DB::raw('TRIM(TRAILING "Item" FROM subclass_type) AS type')) - ->whereIn('id', $this->ids)->distinct()->get()->pluck('type'); + ->select(DB::raw('TRIM(TRAILING "Item" FROM subclass_type) AS type')) + ->whereIn('id', $this->ids)->distinct()->get()->pluck('type'); $fields = []; // Fields at index 0 are intended to be rendered on the left in the // export dialog, and those at index 1 on the right. diff --git a/app/Export/TransfersExport.php b/app/Export/TransfersExport.php index 89e657fb..fc5d6f30 100644 --- a/app/Export/TransfersExport.php +++ b/app/Export/TransfersExport.php @@ -60,8 +60,8 @@ public function exportableFields() // record types. For example, if all the records are AudioItems, we // don't want to return fields that are specific to film. $types = DB::table('transfers') - ->select(DB::raw('TRIM(TRAILING "Transfer" FROM subclass_type) AS type')) - ->whereIn('id', $this->ids)->distinct()->get()->pluck('type'); + ->select(DB::raw('TRIM(TRAILING "Transfer" FROM subclass_type) AS type')) + ->whereIn('id', $this->ids)->distinct()->get()->pluck('type'); $fields = []; // Fields at index 0 are intended to be rendered on the left in the // export dialog, and those at index 1 on the right. diff --git a/app/Http/Controllers/Admin/AdminController.php b/app/Http/Controllers/Admin/AdminController.php index 064f879e..7ef3bf4a 100644 --- a/app/Http/Controllers/Admin/AdminController.php +++ b/app/Http/Controllers/Admin/AdminController.php @@ -36,7 +36,7 @@ public function makeAdmin(Request $request) return response()->json(['status' => 'success'], 200); } - $bag = new MessageBag(); + $bag = new MessageBag; $bag->add('status', 'That user is inactive, so they cannot be made admin.'); return response()->json($bag, 422); diff --git a/app/Http/Controllers/Admin/CollectionTypesController.php b/app/Http/Controllers/Admin/CollectionTypesController.php index 8464be08..8898049a 100644 --- a/app/Http/Controllers/Admin/CollectionTypesController.php +++ b/app/Http/Controllers/Admin/CollectionTypesController.php @@ -77,7 +77,7 @@ public function destroy($id, Request $request) return response()->json($response); } else { - $bag = new MessageBag(); + $bag = new MessageBag; $bag->add('status', 'Looks like that collection type is currently '. 'in use. Change the collection type of the related collections '. 'and/or prefixes before deleting.'); diff --git a/app/Http/Controllers/Admin/CollectionsController.php b/app/Http/Controllers/Admin/CollectionsController.php index 1c896028..c028a99e 100644 --- a/app/Http/Controllers/Admin/CollectionsController.php +++ b/app/Http/Controllers/Admin/CollectionsController.php @@ -63,9 +63,9 @@ public function store(CollectionRequest $request) // Since this is a new collection, create new sequences // for all prefixes with the same collection type ID $results = DB::table('prefixes')->select('label') - ->where('collection_type_id', '=', $collection->collection_type_id) - ->distinct() - ->get(); + ->where('collection_type_id', '=', $collection->collection_type_id) + ->distinct() + ->get(); foreach ($results as $result) { $prefix = $result->label; $sequence = new NewCallNumberSequence; @@ -97,7 +97,7 @@ public function update($id, CollectionRequest $request) DB::transaction(function () use ($id, $collection, &$affectedItems) { if ($collection->isDirty('archival_identifier')) { NewCallNumberSequence::where('collection_id', $id) - ->update(['archival_identifier' => $collection->archival_identifier]); + ->update(['archival_identifier' => $collection->archival_identifier]); } $collection->save(); @@ -132,7 +132,7 @@ public function destroy($id, Request $request) return response()->json($response); } else { - $bag = new MessageBag(); + $bag = new MessageBag; $bag->add('status', 'Looks like that collection is currently in use. '. 'Remove audio visual items from the collection before deleting.'); $response = $bag; diff --git a/app/Http/Controllers/Admin/DepartmentsController.php b/app/Http/Controllers/Admin/DepartmentsController.php index 1033dc46..0467cf91 100644 --- a/app/Http/Controllers/Admin/DepartmentsController.php +++ b/app/Http/Controllers/Admin/DepartmentsController.php @@ -84,7 +84,7 @@ public function destroy($id, Request $request) return response()->json($response); } else { - $bag = new MessageBag(); + $bag = new MessageBag; $bag->add('status', 'Looks like that department is currently in use. '. 'Change the department of the related preservation instances before '. 'deleting.'); diff --git a/app/Http/Controllers/Admin/FormatsController.php b/app/Http/Controllers/Admin/FormatsController.php index 4fe9041f..437947cd 100644 --- a/app/Http/Controllers/Admin/FormatsController.php +++ b/app/Http/Controllers/Admin/FormatsController.php @@ -112,7 +112,7 @@ public function destroy($id, Request $request) return response()->json($response); } else { - $bag = new MessageBag(); + $bag = new MessageBag; $bag->add('status', 'Looks like that format is currently in use. '. 'Change the format of the related audio visual items before '. 'deleting.'); diff --git a/app/Http/Controllers/Admin/PlaybackMachinesController.php b/app/Http/Controllers/Admin/PlaybackMachinesController.php index 4670d233..f4b5043a 100644 --- a/app/Http/Controllers/Admin/PlaybackMachinesController.php +++ b/app/Http/Controllers/Admin/PlaybackMachinesController.php @@ -84,7 +84,7 @@ public function destroy($id, Request $request) return response()->json($response); } else { - $bag = new MessageBag(); + $bag = new MessageBag; $bag->add('status', 'Looks like that playback machine is '. 'currently in use. Change the playback machine of the '. 'related transfers before deleting.'); diff --git a/app/Http/Controllers/Admin/PmSpeedsController.php b/app/Http/Controllers/Admin/PmSpeedsController.php index 9ddaa52b..7046d657 100644 --- a/app/Http/Controllers/Admin/PmSpeedsController.php +++ b/app/Http/Controllers/Admin/PmSpeedsController.php @@ -75,7 +75,7 @@ public function destroy($id, Request $request) return response()->json($response); } else { - $bag = new MessageBag(); + $bag = new MessageBag; $bag->add('status', 'Looks like that PM speed is currently '. 'in use. Change the PM speed of the related preservation '. 'instances before deleting.'); diff --git a/app/Http/Controllers/Admin/ProjectsController.php b/app/Http/Controllers/Admin/ProjectsController.php index 2c2029ec..3f7f469c 100644 --- a/app/Http/Controllers/Admin/ProjectsController.php +++ b/app/Http/Controllers/Admin/ProjectsController.php @@ -84,7 +84,7 @@ public function destroy($id, Request $request) return response()->json($response); } else { - $bag = new MessageBag(); + $bag = new MessageBag; $bag->add('status', 'Looks like that project is currently in use. '. 'Change the project of the related preservation instances before '. 'deleting.'); diff --git a/app/Http/Controllers/Admin/ReproductionMachinesController.php b/app/Http/Controllers/Admin/ReproductionMachinesController.php index bf35eb57..96bdf06c 100644 --- a/app/Http/Controllers/Admin/ReproductionMachinesController.php +++ b/app/Http/Controllers/Admin/ReproductionMachinesController.php @@ -85,7 +85,7 @@ public function destroy($id, Request $request) return response()->json($response); } else { - $bag = new MessageBag(); + $bag = new MessageBag; $bag->add('status', 'Looks like that reproduction machine is '. 'currently in use. Change the reproduction machine of the '. 'related preservation instances before deleting.'); diff --git a/app/Http/Controllers/Admin/SamplingRatesController.php b/app/Http/Controllers/Admin/SamplingRatesController.php index c7b98aef..134a54e3 100644 --- a/app/Http/Controllers/Admin/SamplingRatesController.php +++ b/app/Http/Controllers/Admin/SamplingRatesController.php @@ -75,7 +75,7 @@ public function destroy($id, Request $request) return response()->json($response); } else { - $bag = new MessageBag(); + $bag = new MessageBag; $bag->add('status', 'Looks like that sampling rate is currently '. 'in use. Change the sampling rate of the related preservation '. 'instances before deleting.'); diff --git a/app/Http/Controllers/Admin/TapeBrandsController.php b/app/Http/Controllers/Admin/TapeBrandsController.php index e556f7af..797c9db3 100644 --- a/app/Http/Controllers/Admin/TapeBrandsController.php +++ b/app/Http/Controllers/Admin/TapeBrandsController.php @@ -75,7 +75,7 @@ public function destroy($id, Request $request) return response()->json($response); } else { - $bag = new MessageBag(); + $bag = new MessageBag; $bag->add('status', 'Looks like that tape brand is currently '. 'in use. Change the tape brand of the related preservation '. 'instances before deleting.'); diff --git a/app/Http/Controllers/Admin/UsersController.php b/app/Http/Controllers/Admin/UsersController.php index 561a59c7..7c3812fd 100644 --- a/app/Http/Controllers/Admin/UsersController.php +++ b/app/Http/Controllers/Admin/UsersController.php @@ -23,8 +23,8 @@ public function index(Request $request) { if ($request->ajax()) { $records = User::hasLoggedIn() - ->orderBy('inactive', 'ASC') - ->get(); + ->orderBy('inactive', 'ASC') + ->get(); return view('admin._users', compact('records')); } diff --git a/app/Http/Controllers/Admin/VendorsController.php b/app/Http/Controllers/Admin/VendorsController.php index c03f7132..e6575cc8 100644 --- a/app/Http/Controllers/Admin/VendorsController.php +++ b/app/Http/Controllers/Admin/VendorsController.php @@ -84,7 +84,7 @@ public function destroy($id, Request $request) return response()->json($response); } else { - $bag = new MessageBag(); + $bag = new MessageBag; $bag->add('status', 'Looks like that vendor is currently in use. '. 'Change the vendor of the related transfers before '. 'deleting.'); diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 33b38f82..417be3ea 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -52,16 +52,15 @@ public function login(Request $request) /** * Get the failed login response instance. * - * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ protected function sendFailedLoginResponse(Request $request) { return redirect()->back() - ->withInput($request->only($this->username(), 'remember')) - ->withErrors([ - 'failedLogin' => 'Invalid Onyen or Password', - ]); + ->withInput($request->only($this->username(), 'remember')) + ->withErrors([ + 'failedLogin' => 'Invalid Onyen or Password', + ]); } /** diff --git a/app/Http/Controllers/DashboardController.php b/app/Http/Controllers/DashboardController.php index 12e3b032..26baf24f 100644 --- a/app/Http/Controllers/DashboardController.php +++ b/app/Http/Controllers/DashboardController.php @@ -64,7 +64,7 @@ public function marksForUser(Request $request) $currentUser = Auth::user(); $marks = DashboardMark::fromMarks( Mark::where('user_id', $selectedMarksUserId) - ->orderBy('updated_at', 'desc')->get()); + ->orderBy('updated_at', 'desc')->get()); return view('dashboard._marks', compact('selectedMarksUserId', 'currentUser', 'marks')); diff --git a/app/Http/Controllers/InstancesController.php b/app/Http/Controllers/InstancesController.php index 6dc6bed6..bb268513 100644 --- a/app/Http/Controllers/InstancesController.php +++ b/app/Http/Controllers/InstancesController.php @@ -76,9 +76,9 @@ public function index(Request $request) $instanceIds[] = $instance->id; } $marks = Mark::whereIn('markable_id', $instanceIds) - ->where('markable_type', 'PreservationInstance') - ->where('user_id', Auth::user()->id) - ->get()->pluck('markable_id'); + ->where('markable_type', 'PreservationInstance') + ->where('user_id', Auth::user()->id) + ->get()->pluck('markable_id'); return view('instances._instances', compact('instances', 'marks', 'start', 'sortColumn', 'sortDirection', 'totalRecordCount')); @@ -129,7 +129,7 @@ public function create(Request $request) ReproductionMachine::pluck('name', 'id')->all(); $departments = ['' => 'Select a department'] + Department::pluck('name', 'id')->all(); $projects = ['' => 'Select a project'] + Project::orderBy('name') - ->pluck('name', 'id')->all(); + ->pluck('name', 'id')->all(); $samplingRates = ['' => 'Select a sampling rate'] + SamplingRate::pluck('name', 'id')->all(); @@ -274,7 +274,7 @@ public function batchEdit(Request $request) $subclassType = $first->subclass_type; $instances = PreservationInstance::whereIn('id', $instanceIds) - ->where('subclass_type', $subclassType)->get(); + ->where('subclass_type', $subclassType)->get(); if ($instanceIdsCount !== $instances->count()) { $request->session()->put('alert', ['type' => 'danger', 'message' => 'Oops! There\'s a problem. '. 'Batch editing can only be done with preservation instances of the same type. '. diff --git a/app/Http/Controllers/ItemsController.php b/app/Http/Controllers/ItemsController.php index f5eb3a25..a93895d5 100644 --- a/app/Http/Controllers/ItemsController.php +++ b/app/Http/Controllers/ItemsController.php @@ -75,9 +75,9 @@ public function index(Request $request) $itemIds[] = $item->id; } $marks = Mark::whereIn('markable_id', $itemIds) - ->where('markable_type', 'AudioVisualItem') - ->where('user_id', Auth::user()->id) - ->get()->pluck('markable_id'); + ->where('markable_type', 'AudioVisualItem') + ->where('user_id', Auth::user()->id) + ->get()->pluck('markable_id'); return view('items._items', compact('items', 'marks', 'start', 'sortColumn', 'sortDirection', 'totalRecordCount')); @@ -99,9 +99,9 @@ public function show($id) { $item = AudioVisualItem::findOrFail($id); $cuts = Cut::where('call_number', $item->call_number) - ->orderBy('preservation_instance_id', 'asc') - ->orderBy('cut_number', 'asc') - ->get(); + ->orderBy('preservation_instance_id', 'asc') + ->orderBy('cut_number', 'asc') + ->get(); return view('items.show', compact('item', 'cuts')); } @@ -113,9 +113,9 @@ public function create() { $item = new AudioVisualItem; $collections = ['' => 'Select a collection'] + Collection::orderBy('name', 'asc') - ->pluck('name', 'id')->all(); + ->pluck('name', 'id')->all(); $formats = ['' => 'Select a format'] + Format::withFutureUse()->orderBy('name', 'asc') - ->pluck('name', 'id')->all(); + ->pluck('name', 'id')->all(); return view('items.create', compact('item', 'collections', 'formats')); } @@ -199,13 +199,13 @@ public function edit($id) { $item = AudioVisualItem::findOrFail($id); $cuts = Cut::where('call_number', $item->call_number) - ->orderBy('preservation_instance_id', 'asc') - ->orderBy('cut_number', 'asc') - ->get(); + ->orderBy('preservation_instance_id', 'asc') + ->orderBy('cut_number', 'asc') + ->get(); $collections = ['' => 'Select a collection'] + Collection::orderBy('name', 'asc') - ->pluck('name', 'id')->all(); + ->pluck('name', 'id')->all(); $formats = ['' => 'Select a format'] + Format::orderBy('name', 'asc') - ->pluck('name', 'id')->all(); + ->pluck('name', 'id')->all(); return view('items.edit', compact('item', 'cuts', 'collections', 'formats')); @@ -266,7 +266,7 @@ public function batchEdit(Request $request) $subclassType = $first->subclass_type; $items = AudioVisualItem::whereIn('id', $itemIds) - ->where('subclass_type', $subclassType)->get(); + ->where('subclass_type', $subclassType)->get(); if ($itemIdsCount !== $items->count()) { $request->session()->put('alert', ['type' => 'danger', 'message' => 'Oops! There\'s a problem. '. 'Batch editing can only be done with items of the same type. '. @@ -287,22 +287,22 @@ public function batchEdit(Request $request) $collections = ['' => 'Select a collection'] + ['' => ''] + Collection::orderBy('name', 'asc') - ->pluck('name', 'id')->all(); + ->pluck('name', 'id')->all(); } else { $collections = ['' => 'Select a collection'] + Collection::orderBy('name', 'asc') - ->pluck('name', 'id')->all(); + ->pluck('name', 'id')->all(); } if ($item->format_id === '') { $formats = ['' => 'Select a format'] + ['' => ''] + Format::orderBy('name', 'asc') - ->pluck('name', 'id')->all(); + ->pluck('name', 'id')->all(); } else { $formats = ['' => 'Select a format'] + Format::orderBy('name', 'asc') - ->pluck('name', 'id')->all(); + ->pluck('name', 'id')->all(); } return view('items.edit', diff --git a/app/Http/Controllers/TransfersController.php b/app/Http/Controllers/TransfersController.php index b2ca63c2..d0fb84ca 100644 --- a/app/Http/Controllers/TransfersController.php +++ b/app/Http/Controllers/TransfersController.php @@ -80,9 +80,9 @@ public function index(Request $request) $transferIds[] = $transfer->id; } $marks = Mark::whereIn('markable_id', $transferIds) - ->where('markable_type', 'Transfer') - ->where('user_id', Auth::user()->id) - ->get()->pluck('markable_id'); + ->where('markable_type', 'Transfer') + ->where('user_id', Auth::user()->id) + ->get()->pluck('markable_id'); return view('transfers._transfers', compact('transfers', 'marks', 'start', 'sortColumn', 'sortDirection', 'totalRecordCount')); @@ -238,7 +238,7 @@ public function batchEdit(Request $request) $subclassType = $first->subclass_type; $transfers = Transfer::whereIn('id', $transferIds) - ->where('subclass_type', $subclassType)->get(); + ->where('subclass_type', $subclassType)->get(); if ($transferIdsCount !== $transfers->count()) { $request->session()->put('alert', ['type' => 'danger', 'message' => 'Oops! There\'s a problem. '. 'Batch editing can only be done with transfers of the same type. '. diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php deleted file mode 100644 index 8d82b5e3..00000000 --- a/app/Http/Kernel.php +++ /dev/null @@ -1,53 +0,0 @@ - [ - \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, - \Illuminate\Routing\Middleware\SubstituteBindings::class, - \Illuminate\Session\Middleware\StartSession::class, - \Illuminate\View\Middleware\ShareErrorsFromSession::class, - \Jitterbug\Http\Middleware\EncryptCookies::class, - \Jitterbug\Http\Middleware\VerifyCsrfToken::class, - ], - - 'api' => [ - 'bindings', - 'throttle:60,1', - ], - ]; - - /** - * The application's route middleware. - * - * @var array - */ - protected $routeMiddleware = [ - 'admin' => \Jitterbug\Http\Middleware\Admin::class, - 'auth' => \Jitterbug\Http\Middleware\Authenticate::class, - 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, - 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, - 'can' => \Illuminate\Auth\Middleware\Authorize::class, - 'guest' => \Jitterbug\Http\Middleware\RedirectIfAuthenticated::class, - 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, - ]; -} diff --git a/app/Http/Middleware/Admin.php b/app/Http/Middleware/Admin.php index da5dcae3..9c562c53 100644 --- a/app/Http/Middleware/Admin.php +++ b/app/Http/Middleware/Admin.php @@ -4,17 +4,17 @@ use Auth; use Closure; +use Illuminate\Http\Request; +use Symfony\Component\HttpFoundation\Response; class Admin { /** * Verify the user is an admin. Redirect if they are not. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next * @return mixed */ - public function handle($request, Closure $next) + public function handle(Request $request, Closure $next): Response { if (! Auth::user()->isAdmin()) { return redirect()->route('dashboard.index'); diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index cb6a2950..38742219 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -4,6 +4,8 @@ use Closure; use Illuminate\Contracts\Auth\Guard; +use Illuminate\Http\Request; +use Symfony\Component\HttpFoundation\Response; class Authenticate { @@ -17,7 +19,6 @@ class Authenticate /** * Create a new filter instance. * - * @param Guard $auth * @return void */ public function __construct(Guard $auth) @@ -28,11 +29,9 @@ public function __construct(Guard $auth) /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request - * @param \Closure $next * @return mixed */ - public function handle($request, Closure $next) + public function handle(Request $request, Closure $next): Response { if ($this->auth->guest()) { if ($request->ajax()) { diff --git a/app/Http/Middleware/EncryptCookies.php b/app/Http/Middleware/EncryptCookies.php deleted file mode 100644 index 5f07d2b0..00000000 --- a/app/Http/Middleware/EncryptCookies.php +++ /dev/null @@ -1,17 +0,0 @@ -auth->check()) { return new RedirectResponse(url('/dashboard')); diff --git a/app/Http/Middleware/TrimStrings.php b/app/Http/Middleware/TrimStrings.php deleted file mode 100644 index 1d1dbc6a..00000000 --- a/app/Http/Middleware/TrimStrings.php +++ /dev/null @@ -1,19 +0,0 @@ - - */ - protected $except = [ - 'current_password', - 'password', - 'password_confirmation', - ]; -} diff --git a/app/Http/Middleware/TrustProxies.php b/app/Http/Middleware/TrustProxies.php deleted file mode 100644 index db957275..00000000 --- a/app/Http/Middleware/TrustProxies.php +++ /dev/null @@ -1,28 +0,0 @@ -|string|null - */ - protected $proxies; - - /** - * The headers that should be used to detect proxies. - * - * @var int - */ - protected $headers = - Request::HEADER_X_FORWARDED_FOR | - Request::HEADER_X_FORWARDED_HOST | - Request::HEADER_X_FORWARDED_PORT | - Request::HEADER_X_FORWARDED_PROTO | - Request::HEADER_X_FORWARDED_AWS_ELB; -} diff --git a/app/Http/Middleware/VerifyCsrfToken.php b/app/Http/Middleware/VerifyCsrfToken.php deleted file mode 100644 index 66ce8bac..00000000 --- a/app/Http/Middleware/VerifyCsrfToken.php +++ /dev/null @@ -1,21 +0,0 @@ - 'A collection name is required.', diff --git a/app/Http/Requests/CollectionTypeRequest.php b/app/Http/Requests/CollectionTypeRequest.php index 4092529a..0c94fba1 100644 --- a/app/Http/Requests/CollectionTypeRequest.php +++ b/app/Http/Requests/CollectionTypeRequest.php @@ -8,27 +8,23 @@ class CollectionTypeRequest extends FormRequest { /** * Determine if the user is authorized to make this request. - * - * @return bool */ - public function authorize() + public function authorize(): bool { return true; } /** * Get the validation rules that apply to the request. - * - * @return array */ - public function rules() + public function rules(): array { return [ 'name' => 'required|min:2|max:255|unique:collection_types,name,', ]; } - public function messages() + public function messages(): array { return [ 'name.required' => 'A collection type name is required.', diff --git a/app/Http/Requests/CutRequest.php b/app/Http/Requests/CutRequest.php index 58a26d5d..62016334 100644 --- a/app/Http/Requests/CutRequest.php +++ b/app/Http/Requests/CutRequest.php @@ -6,20 +6,16 @@ class CutRequest extends Request { /** * Determine if the user is authorized to make this request. - * - * @return bool */ - public function authorize() + public function authorize(): bool { return true; } /** * Get the validation rules that apply to the request. - * - * @return array */ - public function rules() + public function rules(): array { return [ 'preservation_instance_id' => 'required|exists:preservation_instances,id,deleted_at,NULL', @@ -36,7 +32,7 @@ public function rules() * * @return array of messages */ - public function messages() + public function messages(): array { return [ // Messages for transfer fields diff --git a/app/Http/Requests/DepartmentRequest.php b/app/Http/Requests/DepartmentRequest.php index 4cf11cb5..8026e71e 100644 --- a/app/Http/Requests/DepartmentRequest.php +++ b/app/Http/Requests/DepartmentRequest.php @@ -6,20 +6,16 @@ class DepartmentRequest extends Request { /** * Determine if the user is authorized to make this request. - * - * @return bool */ - public function authorize() + public function authorize(): bool { return true; } /** * Get the validation rules that apply to the request. - * - * @return array */ - public function rules() + public function rules(): array { return [ 'name' => 'required|min:2|max:255|unique:departments,name,'. @@ -32,7 +28,7 @@ public function rules() * * @return array of messages */ - public function messages() + public function messages(): array { return [ 'name.required' => 'A department name is required.', diff --git a/app/Http/Requests/FormatRequest.php b/app/Http/Requests/FormatRequest.php index b3286e03..39a41db3 100644 --- a/app/Http/Requests/FormatRequest.php +++ b/app/Http/Requests/FormatRequest.php @@ -6,20 +6,16 @@ class FormatRequest extends Request { /** * Determine if the user is authorized to make this request. - * - * @return bool */ - public function authorize() + public function authorize(): bool { return true; } /** * Get the validation rules that apply to the request. - * - * @return array */ - public function rules() + public function rules(): array { $required = ''; // Only require if it's a new record @@ -38,7 +34,7 @@ public function rules() * * @return array of messages */ - public function messages() + public function messages(): array { return [ 'name.required' => 'A format name is required.', diff --git a/app/Http/Requests/InstanceRequest.php b/app/Http/Requests/InstanceRequest.php index f4e509dc..dcbd08ec 100644 --- a/app/Http/Requests/InstanceRequest.php +++ b/app/Http/Requests/InstanceRequest.php @@ -9,20 +9,16 @@ class InstanceRequest extends Request { /** * Determine if the user is authorized to make this request. - * - * @return bool */ - public function authorize() + public function authorize(): bool { return true; } /** * Get the validation rules that apply to the request. - * - * @return array */ - public function rules() + public function rules(): array { // Add rules for base preservation instances $rules = []; @@ -53,13 +49,13 @@ public function rules() $this->addRuleIfNotMixed($rules, 'audio_file_codec', 'required|max:60'); $this->addRuleIfNotMixed($rules, 'subclass.sampling_rate_id', 'required'); $this->addRuleIfNotMixed($rules, 'subclass.test_tones', 'max:255'); - // Add rules for film instances + // Add rules for film instances } elseif ($subclassType === 'FilmInstance') { $this->addRuleIfNotMixed($rules, 'film_file_format', 'required|max:60'); $this->addRuleIfNotMixed($rules, 'film_file_codec', 'required|max:60'); $this->addRuleIfNotMixed($rules, 'subclass.film_frame_size', 'max:30'); $this->addRuleIfNotMixed($rules, 'subclass.film_aspect_ratio', 'max:30'); - // Add rules for video instances + // Add rules for video instances } elseif ($subclassType === 'VideoInstance') { $this->addRuleIfNotMixed($rules, 'video_file_format', 'required|max:60'); $this->addRuleIfNotMixed($rules, 'video_file_codec', 'required|max:60'); @@ -75,7 +71,7 @@ public function rules() * * @return array of messages */ - public function messages() + public function messages(): array { return [ // Messages for preservation instance fields diff --git a/app/Http/Requests/ItemRequest.php b/app/Http/Requests/ItemRequest.php index 807e0192..4ac4bc10 100644 --- a/app/Http/Requests/ItemRequest.php +++ b/app/Http/Requests/ItemRequest.php @@ -6,20 +6,16 @@ class ItemRequest extends Request { /** * Determine if the user is authorized to make this request. - * - * @return bool */ - public function authorize() + public function authorize(): bool { return true; } /** * Get the validation rules that apply to the request. - * - * @return array */ - public function rules() + public function rules(): array { // Add rules for base audio visual item $rules = []; @@ -53,7 +49,7 @@ public function rules() $this->addRuleIfNotMixed($rules, 'subclass.track_configuration', 'max:100'); $this->addRuleIfNotMixed($rules, 'subclass.audio_base', 'max:100'); $this->addRuleIfNotMixed($rules, 'subclass.audio_content_description', 'max:1000'); - // Add rules for film items + // Add rules for film items } elseif ($subclassType === 'FilmItem') { $this->addRuleIfNotMixed($rules, 'subclass.film_element', 'max:255'); $this->addRuleIfNotMixed($rules, 'subclass.film_base', 'required|max:255'); @@ -65,7 +61,7 @@ public function rules() $this->addRuleIfNotMixed($rules, 'subclass.can_number', 'integer|digits_between:0,6'); $this->addRuleIfNotMixed($rules, 'subclass.condition', 'max:255'); $this->addRuleIfNotMixed($rules, 'subclass.film_content_description', 'max:1000'); - // Add rules for video items + // Add rules for video items } elseif ($subclassType === 'VideoItem') { $this->addRuleIfNotMixed($rules, 'subclass.video_element', 'max:255'); $this->addRuleIfNotMixed($rules, 'subclass.video_color', 'max:255'); @@ -81,7 +77,7 @@ public function rules() * * @return array of messages */ - public function messages() + public function messages(): array { return [ // Messages for audio visual item fields diff --git a/app/Http/Requests/PlaybackMachineRequest.php b/app/Http/Requests/PlaybackMachineRequest.php index 617dbcce..417ad256 100644 --- a/app/Http/Requests/PlaybackMachineRequest.php +++ b/app/Http/Requests/PlaybackMachineRequest.php @@ -6,20 +6,16 @@ class PlaybackMachineRequest extends Request { /** * Determine if the user is authorized to make this request. - * - * @return bool */ - public function authorize() + public function authorize(): bool { return true; } /** * Get the validation rules that apply to the request. - * - * @return array */ - public function rules() + public function rules(): array { return [ 'name' => 'required|min:2|max:255|unique:playback_machines,name,'. @@ -32,7 +28,7 @@ public function rules() * * @return array of messages */ - public function messages() + public function messages(): array { return [ 'name.required' => 'A playback machine name is required.', diff --git a/app/Http/Requests/PmSpeedRequest.php b/app/Http/Requests/PmSpeedRequest.php index cb7f07ee..d632e725 100644 --- a/app/Http/Requests/PmSpeedRequest.php +++ b/app/Http/Requests/PmSpeedRequest.php @@ -6,20 +6,16 @@ class PmSpeedRequest extends Request { /** * Determine if the user is authorized to make this request. - * - * @return bool */ - public function authorize() + public function authorize(): bool { return true; } /** * Get the validation rules that apply to the request. - * - * @return array */ - public function rules() + public function rules(): array { return [ 'name' => 'required|min:2|max:255|unique:pm_speeds,name,'. @@ -32,7 +28,7 @@ public function rules() * * @return array of messages */ - public function messages() + public function messages(): array { return [ 'name.required' => 'A PM speed name is required.', diff --git a/app/Http/Requests/PrefixRequest.php b/app/Http/Requests/PrefixRequest.php index 90ce2718..45be2382 100644 --- a/app/Http/Requests/PrefixRequest.php +++ b/app/Http/Requests/PrefixRequest.php @@ -8,20 +8,16 @@ class PrefixRequest extends FormRequest { /** * Determine if the user is authorized to make this request. - * - * @return bool */ - public function authorize() + public function authorize(): bool { return true; } /** * Get the validation rules that apply to the request. - * - * @return array */ - public function rules() + public function rules(): array { $required = ''; // Only require the fields if it's a new record @@ -35,7 +31,7 @@ public function rules() ]; } - public function messages() + public function messages(): array { return [ 'label.required' => 'A prefix label is required.', diff --git a/app/Http/Requests/ProjectRequest.php b/app/Http/Requests/ProjectRequest.php index 575f50eb..d81c1da5 100644 --- a/app/Http/Requests/ProjectRequest.php +++ b/app/Http/Requests/ProjectRequest.php @@ -6,20 +6,16 @@ class ProjectRequest extends Request { /** * Determine if the user is authorized to make this request. - * - * @return bool */ - public function authorize() + public function authorize(): bool { return true; } /** * Get the validation rules that apply to the request. - * - * @return array */ - public function rules() + public function rules(): array { return [ 'name' => 'required|min:2|max:255|unique:projects,name,'. @@ -32,7 +28,7 @@ public function rules() * * @return array of messages */ - public function messages() + public function messages(): array { return [ 'name.required' => 'A project name is required.', diff --git a/app/Http/Requests/ReproductionMachineRequest.php b/app/Http/Requests/ReproductionMachineRequest.php index fb0b6c57..15b39cdc 100644 --- a/app/Http/Requests/ReproductionMachineRequest.php +++ b/app/Http/Requests/ReproductionMachineRequest.php @@ -6,20 +6,16 @@ class ReproductionMachineRequest extends Request { /** * Determine if the user is authorized to make this request. - * - * @return bool */ - public function authorize() + public function authorize(): bool { return true; } /** * Get the validation rules that apply to the request. - * - * @return array */ - public function rules() + public function rules(): array { return [ 'name' => 'required|min:2|max:255|unique:reproduction_machines,name,'. @@ -32,7 +28,7 @@ public function rules() * * @return array of messages */ - public function messages() + public function messages(): array { return [ 'name.required' => 'A reproduction machine name is required.', diff --git a/app/Http/Requests/SamplingRateRequest.php b/app/Http/Requests/SamplingRateRequest.php index bda70c89..7d7a86fe 100644 --- a/app/Http/Requests/SamplingRateRequest.php +++ b/app/Http/Requests/SamplingRateRequest.php @@ -6,20 +6,16 @@ class SamplingRateRequest extends Request { /** * Determine if the user is authorized to make this request. - * - * @return bool */ - public function authorize() + public function authorize(): bool { return true; } /** * Get the validation rules that apply to the request. - * - * @return array */ - public function rules() + public function rules(): array { return [ 'name' => 'required|min:2|max:255|unique:sampling_rates,name,'. @@ -32,7 +28,7 @@ public function rules() * * @return array of messages */ - public function messages() + public function messages(): array { return [ 'name.required' => 'A sampling rate name is required.', diff --git a/app/Http/Requests/TapeBrandRequest.php b/app/Http/Requests/TapeBrandRequest.php index d9198648..d8456efb 100644 --- a/app/Http/Requests/TapeBrandRequest.php +++ b/app/Http/Requests/TapeBrandRequest.php @@ -6,20 +6,16 @@ class TapeBrandRequest extends Request { /** * Determine if the user is authorized to make this request. - * - * @return bool */ - public function authorize() + public function authorize(): bool { return true; } /** * Get the validation rules that apply to the request. - * - * @return array */ - public function rules() + public function rules(): array { return [ 'name' => 'required|min:2|max:255|unique:tape_brands,name,'. @@ -32,7 +28,7 @@ public function rules() * * @return array of messages */ - public function messages() + public function messages(): array { return [ 'name.required' => 'A tape brand name is required.', diff --git a/app/Http/Requests/TransferRequest.php b/app/Http/Requests/TransferRequest.php index 0d30442a..6b753a6a 100644 --- a/app/Http/Requests/TransferRequest.php +++ b/app/Http/Requests/TransferRequest.php @@ -8,20 +8,16 @@ class TransferRequest extends Request { /** * Determine if the user is authorized to make this request. - * - * @return bool */ - public function authorize() + public function authorize(): bool { return true; } /** * Get the validation rules that apply to the request. - * - * @return array */ - public function rules() + public function rules(): array { // Add rules for base transfer $rules = []; @@ -38,7 +34,7 @@ public function rules() $this->addRuleIfNotMixed($rules, 'subclass.stylus', 'max:255'); $this->addRuleIfNotMixed($rules, 'subclass.cartridge', 'max:255'); $this->addRuleIfNotMixed($rules, 'subclass.first_sound', 'max:1000'); - // Add rules for film transfers + // Add rules for film transfers } elseif ($subclassType === 'FilmTransfer') { // No film transfer rules at the moment // Add rules for video transfers @@ -55,7 +51,7 @@ public function rules() * * @return array of messages */ - public function messages() + public function messages(): array { return [ // Messages for transfer fields diff --git a/app/Http/Requests/VendorRequest.php b/app/Http/Requests/VendorRequest.php index 5960f7d1..59d00f1d 100644 --- a/app/Http/Requests/VendorRequest.php +++ b/app/Http/Requests/VendorRequest.php @@ -6,20 +6,16 @@ class VendorRequest extends Request { /** * Determine if the user is authorized to make this request. - * - * @return bool */ - public function authorize() + public function authorize(): bool { return true; } /** * Get the validation rules that apply to the request. - * - * @return array */ - public function rules() + public function rules(): array { return [ 'name' => 'required|min:2|max:255|unique:vendors,name,'. @@ -32,7 +28,7 @@ public function rules() * * @return array of messages */ - public function messages() + public function messages(): array { return [ 'name.required' => 'A vendor name is required.', diff --git a/app/Http/helpers.php b/app/Http/helpers.php index 089bb57b..b2059592 100644 --- a/app/Http/helpers.php +++ b/app/Http/helpers.php @@ -11,7 +11,7 @@ function routeName() */ function fileTimestamp() { - $date = new DateTime(); + $date = new DateTime; $date->setTimezone(new DateTimeZone('America/New_York')); $timestamp = $date->format('Y-m-d-H-i-sO'); diff --git a/app/Import/AudioImport.php b/app/Import/AudioImport.php index 9ea1de3f..3d05038f 100644 --- a/app/Import/AudioImport.php +++ b/app/Import/AudioImport.php @@ -67,7 +67,7 @@ public function validate() $originatorReferences = []; $messages = []; foreach ($this->data as $row) { - $bag = new MessageBag(); + $bag = new MessageBag; $messages[] = $bag; foreach ($this->audioImportKeys as $key) { // if the batch import edit field is empty, this is a new record diff --git a/app/Import/ItemsImport.php b/app/Import/ItemsImport.php index 191ef6e4..2dc5c911 100644 --- a/app/Import/ItemsImport.php +++ b/app/Import/ItemsImport.php @@ -50,7 +50,7 @@ public function validate() { $messages = []; foreach ($this->data as $row) { - $bag = new MessageBag(); + $bag = new MessageBag; $messages[] = $bag; $callNumbers = []; $formatExists = $this->formatExists($row['FormatID']); diff --git a/app/Import/VideoImport.php b/app/Import/VideoImport.php index bfff5a60..d6d6b751 100644 --- a/app/Import/VideoImport.php +++ b/app/Import/VideoImport.php @@ -55,7 +55,7 @@ public function validate() $fileNames = []; $messages = []; foreach ($this->data as $row) { - $bag = new MessageBag(); + $bag = new MessageBag; $messages[] = $bag; foreach ($this->videoImportKeys as $key) { // Validate that all required fields have values diff --git a/app/Models/Activity.php b/app/Models/Activity.php index a85819f2..4f7db3ee 100644 --- a/app/Models/Activity.php +++ b/app/Models/Activity.php @@ -77,7 +77,7 @@ public function getTimeAgoAttribute($value) $value = $this->timestamp; } - $timeAgo = new TimeAgo(); + $timeAgo = new TimeAgo; return $timeAgo->inWordsFromStrings($value); } diff --git a/app/Models/AudioInstance.php b/app/Models/AudioInstance.php index cf6d4003..929b0e19 100644 --- a/app/Models/AudioInstance.php +++ b/app/Models/AudioInstance.php @@ -4,15 +4,16 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\SoftDeletes; use Venturecraft\Revisionable\RevisionableTrait; class AudioInstance extends Model { + use HasFactory; use NullFieldPreserver; use RevisionableTrait; use SoftDeletes; - use HasFactory; protected $revisionCreationsEnabled = true; @@ -38,17 +39,17 @@ public function superclass() return $this->morphOne('PreservationInstance', 'subclass')->withTrashed(); } - public function tapeBrand() + public function tapeBrand(): BelongsTo { return $this->belongsTo(\Jitterbug\Models\TapeBrand::class); } - public function pmSpeed() + public function pmSpeed(): BelongsTo { return $this->belongsTo(\Jitterbug\Models\PmSpeed::class); } - public function samplingRate() + public function samplingRate(): BelongsTo { return $this->belongsTo(\Jitterbug\Models\SamplingRate::class); } diff --git a/app/Models/AudioItem.php b/app/Models/AudioItem.php index 1eb2f842..b75e5980 100644 --- a/app/Models/AudioItem.php +++ b/app/Models/AudioItem.php @@ -9,10 +9,10 @@ class AudioItem extends Model { + use HasFactory; use NullFieldPreserver; use RevisionableTrait; use SoftDeletes; - use HasFactory; protected $revisionCreationsEnabled = true; diff --git a/app/Models/AudioTransfer.php b/app/Models/AudioTransfer.php index f00d1135..7149c551 100644 --- a/app/Models/AudioTransfer.php +++ b/app/Models/AudioTransfer.php @@ -9,10 +9,10 @@ class AudioTransfer extends Model { + use HasFactory; use NullFieldPreserver; use RevisionableTrait; use SoftDeletes; - use HasFactory; protected $revisionCreationsEnabled = true; diff --git a/app/Models/AudioVisualItem.php b/app/Models/AudioVisualItem.php index 189725ef..22a316a2 100644 --- a/app/Models/AudioVisualItem.php +++ b/app/Models/AudioVisualItem.php @@ -4,17 +4,20 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Database\Eloquent\Relations\MorphTo; use Illuminate\Database\Eloquent\SoftDeletes; use Venturecraft\Revisionable\RevisionableTrait; class AudioVisualItem extends Model { + use CompositeHistory; + use HasFactory; + use Markable; use NullFieldPreserver; use RevisionableTrait; - use CompositeHistory; use SoftDeletes; - use Markable; - use HasFactory; const BATCH_EDIT_MAX_LIMIT = 1000; @@ -71,7 +74,7 @@ class AudioVisualItem extends Model public function __construct($attributes = []) { $this->subclass_type = 'AudioItem'; - $this->entry_date = (new \DateTime())->format('Y-m-d'); + $this->entry_date = (new \DateTime)->format('Y-m-d'); parent::__construct($attributes); } @@ -80,29 +83,29 @@ public function batch() return false; } - public function collection() + public function collection(): BelongsTo { return $this->belongsTo(\Jitterbug\Models\Collection::class); } - public function format() + public function format(): BelongsTo { return $this->belongsTo(\Jitterbug\Models\Format::class); } - public function preservationInstances() + public function preservationInstances(): HasMany { return $this->hasMany(\Jitterbug\Models\PreservationInstance::class, 'call_number', 'call_number'); } - public function cuts() + public function cuts(): HasMany { return $this->hasMany(\Jitterbug\Models\Cut::class, 'call_number', 'call_number'); } - public function subclass() + public function subclass(): MorphTo { return $this->morphTo(); } diff --git a/app/Models/AudioVisualItemCollection.php b/app/Models/AudioVisualItemCollection.php index 6944b8fa..b773ca2c 100644 --- a/app/Models/AudioVisualItemCollection.php +++ b/app/Models/AudioVisualItemCollection.php @@ -8,6 +8,4 @@ * Simple model for displaying collection filters in the Audio Visual Items * section of the application. The underlying database object is a view. */ -class AudioVisualItemCollection extends Model -{ -} +class AudioVisualItemCollection extends Model {} diff --git a/app/Models/AudioVisualItemFormat.php b/app/Models/AudioVisualItemFormat.php index 434288de..40aaa950 100644 --- a/app/Models/AudioVisualItemFormat.php +++ b/app/Models/AudioVisualItemFormat.php @@ -8,6 +8,4 @@ * Simple model for displaying format filters in the Audio Visual Items * section of the application. The underlying database object is a view. */ -class AudioVisualItemFormat extends Model -{ -} +class AudioVisualItemFormat extends Model {} diff --git a/app/Models/AudioVisualItemType.php b/app/Models/AudioVisualItemType.php index 7dc81103..da6ad4c1 100644 --- a/app/Models/AudioVisualItemType.php +++ b/app/Models/AudioVisualItemType.php @@ -8,6 +8,4 @@ * Simple model for displaying type filters in the Audio Visual Items * section of the application. The underlying database object is a view. */ -class AudioVisualItemType extends Model -{ -} +class AudioVisualItemType extends Model {} diff --git a/app/Models/CallNumberSequence.php b/app/Models/CallNumberSequence.php index f0c1d272..7eb27a89 100644 --- a/app/Models/CallNumberSequence.php +++ b/app/Models/CallNumberSequence.php @@ -18,7 +18,7 @@ public static function next($collectionId, $formatId) where('collection_id', '=', $collectionId)->first(); if ($sequence === null) { if (in_array($prefix, self::ALWAYS_USE_NEW_STYLE)) { - $sequence = new NewCallNumberSequence(); + $sequence = new NewCallNumberSequence; $sequence->prefix = $prefix; $sequence->collection_id = $collectionId; $sequence->archival_identifier = $archivalIdentifier; diff --git a/app/Models/Collection.php b/app/Models/Collection.php index 933170a1..39eb0985 100644 --- a/app/Models/Collection.php +++ b/app/Models/Collection.php @@ -4,22 +4,24 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\SoftDeletes; class Collection extends Model { + use HasFactory; use NullFieldPreserver; use SoftDeletes; - use HasFactory; protected $fillable = ['name', 'collection_type_id', 'archival_identifier']; - public function audioVisualItems() + public function audioVisualItems(): HasMany { return $this->hasMany(\Jitterbug\Models\AudioVisualItem::class); } - public function collectionType() + public function collectionType(): BelongsTo { return $this->belongsTo(CollectionType::class); } diff --git a/app/Models/CollectionType.php b/app/Models/CollectionType.php index a39810e9..5a011d72 100644 --- a/app/Models/CollectionType.php +++ b/app/Models/CollectionType.php @@ -4,21 +4,22 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\SoftDeletes; class CollectionType extends Model { - use SoftDeletes; use HasFactory; + use SoftDeletes; protected $fillable = ['name']; - public function collections() + public function collections(): HasMany { return $this->hasMany(Collection::class); } - public function prefixes() + public function prefixes(): HasMany { return $this->hasMany(Prefix::class); } diff --git a/app/Models/Cut.php b/app/Models/Cut.php index b63828ed..24a39c24 100644 --- a/app/Models/Cut.php +++ b/app/Models/Cut.php @@ -4,15 +4,16 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\SoftDeletes; use Venturecraft\Revisionable\RevisionableTrait; class Cut extends Model { + use HasFactory; use NullFieldPreserver; use RevisionableTrait; use SoftDeletes; - use HasFactory; protected $revisionFormattedFields = [ 'side' => 'isEmpty:nothing|%s', @@ -36,17 +37,17 @@ class Cut extends Model protected $revisionCreationsEnabled = true; - public function item() + public function item(): BelongsTo { return $this->belongsTo(\Jitterbug\Models\AudioVisualItem::class, 'call_number', 'call_number'); } - public function preservationInstance() + public function preservationInstance(): BelongsTo { return $this->belongsTo(\Jitterbug\Models\PreservationInstance::class); } - public function transfer() + public function transfer(): BelongsTo { return $this->belongsTo(\Jitterbug\Models\Transfer::class); } diff --git a/app/Models/Department.php b/app/Models/Department.php index 3ded0d98..14f28c16 100644 --- a/app/Models/Department.php +++ b/app/Models/Department.php @@ -4,17 +4,18 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\SoftDeletes; class Department extends Model { + use HasFactory; use NullFieldPreserver; use SoftDeletes; - use HasFactory; protected $fillable = ['name']; - public function preservationInstances() + public function preservationInstances(): HasMany { return $this->hasMany(\Jitterbug\Models\PreservationInstance::class); } diff --git a/app/Models/Format.php b/app/Models/Format.php index e674a42f..72e7b980 100644 --- a/app/Models/Format.php +++ b/app/Models/Format.php @@ -4,13 +4,15 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsToMany; +use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\SoftDeletes; class Format extends Model { + use HasFactory; use NullFieldPreserver; use SoftDeletes; - use HasFactory; protected $fillable = ['name', 'prefix', 'legacy_prefix']; @@ -18,15 +20,15 @@ class Format extends Model public function scopeWithFutureUse($query) { return $query->where('id', '<>', 25) - ->where('id', '<>', 54); + ->where('id', '<>', 54); } - public function audioVisualItems() + public function audioVisualItems(): HasMany { return $this->hasMany(AudioVisualItem::class); } - public function prefixes() + public function prefixes(): BelongsToMany { return $this->belongsToMany(Prefix::class)->withTimestamps(); } diff --git a/app/Models/Markable.php b/app/Models/Markable.php index 2d488ecd..296629a3 100644 --- a/app/Models/Markable.php +++ b/app/Models/Markable.php @@ -51,7 +51,7 @@ public function removeMark() public function removeAllMarks() { $marks = Mark::where('markable_type', class_basename(get_class($this))) - ->where('markable_id', $this->id)->get(); + ->where('markable_id', $this->id)->get(); foreach ($marks as $mark) { $mark->delete(); } @@ -60,7 +60,7 @@ public function removeAllMarks() private function getMark() { return Mark::where('markable_type', class_basename(get_class($this))) - ->where('markable_id', $this->id) - ->where('user_id', \Auth::user()->id)->first(); + ->where('markable_id', $this->id) + ->where('user_id', \Auth::user()->id)->first(); } } diff --git a/app/Models/PlaybackMachine.php b/app/Models/PlaybackMachine.php index bfc04b31..eb04d8ef 100644 --- a/app/Models/PlaybackMachine.php +++ b/app/Models/PlaybackMachine.php @@ -8,9 +8,9 @@ class PlaybackMachine extends Model { + use HasFactory; use NullFieldPreserver; use SoftDeletes; - use HasFactory; protected $fillable = ['name']; diff --git a/app/Models/Prefix.php b/app/Models/Prefix.php index 08cfba7f..e74fe939 100644 --- a/app/Models/Prefix.php +++ b/app/Models/Prefix.php @@ -4,22 +4,24 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Support\Facades\DB; class Prefix extends Model { - use SoftDeletes; use HasFactory; + use SoftDeletes; protected $fillable = ['label', 'legacy', 'collection_type_id']; - public function collectionType() + public function collectionType(): BelongsTo { return $this->belongsTo(CollectionType::class); } - public function formats() + public function formats(): BelongsToMany { return $this->belongsToMany(Format::class)->withTimestamps(); } @@ -32,9 +34,9 @@ public function detachAllFormats() public static function findPrefixLabel($formatId, $collectionId) { $collectionTypeIdQuery = DB::table('collections')->select('collection_type_id') - ->where('id', '=', $collectionId) - ->get() - ->first(); + ->where('id', '=', $collectionId) + ->get() + ->first(); if ($collectionTypeIdQuery === null) { $message = 'Collection does not have a collection type ID.'; @@ -46,13 +48,13 @@ public static function findPrefixLabel($formatId, $collectionId) // find the prefix attached to the specified format // that has the same collection type ID as the specified collection $labelQuery = DB::table('prefixes')->select('label') - ->join('format_prefix', 'prefixes.id', '=', 'format_prefix.prefix_id') - ->where([ - ['format_prefix.format_id', '=', $formatId], - ['prefixes.collection_type_id', '=', $collectionTypeId], - ]) - ->get() - ->first(); + ->join('format_prefix', 'prefixes.id', '=', 'format_prefix.prefix_id') + ->where([ + ['format_prefix.format_id', '=', $formatId], + ['prefixes.collection_type_id', '=', $collectionTypeId], + ]) + ->get() + ->first(); if ($labelQuery === null) { abort(404, 'Unable to find prefix for this format ID and collection ID.'); diff --git a/app/Models/PreservationInstance.php b/app/Models/PreservationInstance.php index eb237fe8..00898edc 100644 --- a/app/Models/PreservationInstance.php +++ b/app/Models/PreservationInstance.php @@ -4,18 +4,21 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\HasMany; +use Illuminate\Database\Eloquent\Relations\MorphTo; use Illuminate\Database\Eloquent\SoftDeletes; use Jitterbug\Util\DurationFormat; use Venturecraft\Revisionable\RevisionableTrait; class PreservationInstance extends Model { + use CompositeHistory; + use HasFactory; + use Markable; use NullFieldPreserver; use RevisionableTrait; - use CompositeHistory; use SoftDeletes; - use Markable; - use HasFactory; const BATCH_EDIT_MAX_LIMIT = 1000; @@ -65,37 +68,37 @@ public function batch() return false; } - public function item() + public function item(): BelongsTo { return $this->belongsTo(\Jitterbug\Models\AudioVisualItem::class, 'call_number', 'call_number'); } - public function cuts() + public function cuts(): HasMany { return $this->hasMany(\Jitterbug\Models\Cut::class); } - public function transfers() + public function transfers(): HasMany { return $this->hasMany(\Jitterbug\Models\Transfer::class); } - public function department() + public function department(): BelongsTo { return $this->belongsTo(\Jitterbug\Models\Department::class); } - public function project() + public function project(): BelongsTo { return $this->belongsTo(\Jitterbug\Models\Project::class); } - public function reproductionMachine() + public function reproductionMachine(): BelongsTo { return $this->belongsTo(\Jitterbug\Models\ReproductionMachine::class); } - public function subclass() + public function subclass(): MorphTo { return $this->morphTo(); } diff --git a/app/Models/PreservationInstanceCollection.php b/app/Models/PreservationInstanceCollection.php index 4d2618bd..10b05e3a 100644 --- a/app/Models/PreservationInstanceCollection.php +++ b/app/Models/PreservationInstanceCollection.php @@ -4,6 +4,4 @@ use Illuminate\Database\Eloquent\Model; -class PreservationInstanceCollection extends Model -{ -} +class PreservationInstanceCollection extends Model {} diff --git a/app/Models/PreservationInstanceDepartment.php b/app/Models/PreservationInstanceDepartment.php index c230fdfb..9bf07cb6 100644 --- a/app/Models/PreservationInstanceDepartment.php +++ b/app/Models/PreservationInstanceDepartment.php @@ -4,6 +4,4 @@ use Illuminate\Database\Eloquent\Model; -class PreservationInstanceDepartment extends Model -{ -} +class PreservationInstanceDepartment extends Model {} diff --git a/app/Models/PreservationInstanceFormat.php b/app/Models/PreservationInstanceFormat.php index 797ef42e..df51b312 100644 --- a/app/Models/PreservationInstanceFormat.php +++ b/app/Models/PreservationInstanceFormat.php @@ -4,6 +4,4 @@ use Illuminate\Database\Eloquent\Model; -class PreservationInstanceFormat extends Model -{ -} +class PreservationInstanceFormat extends Model {} diff --git a/app/Models/PreservationInstanceType.php b/app/Models/PreservationInstanceType.php index 13f3261c..5cbde631 100644 --- a/app/Models/PreservationInstanceType.php +++ b/app/Models/PreservationInstanceType.php @@ -8,6 +8,4 @@ * Simple model for displaying type filters in the Preservation Instances * section of the application. The underlying database object is a view. */ -class PreservationInstanceType extends Model -{ -} +class PreservationInstanceType extends Model {} diff --git a/app/Models/Project.php b/app/Models/Project.php index 36aec08d..6b0bbc63 100644 --- a/app/Models/Project.php +++ b/app/Models/Project.php @@ -8,9 +8,9 @@ class Project extends Model { + use HasFactory; use NullFieldPreserver; use SoftDeletes; - use HasFactory; protected $fillable = ['name']; diff --git a/app/Models/ReproductionMachine.php b/app/Models/ReproductionMachine.php index aac30c1e..a488c250 100644 --- a/app/Models/ReproductionMachine.php +++ b/app/Models/ReproductionMachine.php @@ -8,9 +8,9 @@ class ReproductionMachine extends Model { + use HasFactory; use NullFieldPreserver; use SoftDeletes; - use HasFactory; protected $fillable = ['name']; diff --git a/app/Models/Transfer.php b/app/Models/Transfer.php index 5ba2eb77..56323d4d 100644 --- a/app/Models/Transfer.php +++ b/app/Models/Transfer.php @@ -4,17 +4,20 @@ use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Relations\BelongsTo; +use Illuminate\Database\Eloquent\Relations\HasOne; +use Illuminate\Database\Eloquent\Relations\MorphTo; use Illuminate\Database\Eloquent\SoftDeletes; use Venturecraft\Revisionable\RevisionableTrait; class Transfer extends Model { + use CompositeHistory; + use HasFactory; + use Markable; use NullFieldPreserver; use RevisionableTrait; - use CompositeHistory; use SoftDeletes; - use Markable; - use HasFactory; const BATCH_EDIT_MAX_LIMIT = 1000; @@ -65,11 +68,11 @@ class Transfer extends Model public function __construct($attributes = []) { $this->subclass_type = 'AudioTransfer'; - $this->transfer_date = (new \DateTime())->format('Y-m-d'); + $this->transfer_date = (new \DateTime)->format('Y-m-d'); parent::__construct($attributes); } - public function item() + public function item(): BelongsTo { return $this->belongsTo(\Jitterbug\Models\AudioVisualItem::class, 'call_number', 'call_number'); } @@ -77,12 +80,12 @@ public function item() /** * Return the associated cut, if there is one. */ - public function cut() + public function cut(): HasOne { return $this->hasOne(\Jitterbug\Models\Cut::class); } - public function engineer() + public function engineer(): BelongsTo { return $this->belongsTo(\Jitterbug\Models\User::class, 'engineer_id'); } @@ -98,22 +101,22 @@ public function getEngineerNameAttribute() return $engineer->fullName(); } - public function playbackMachine() + public function playbackMachine(): BelongsTo { return $this->belongsTo(\Jitterbug\Models\PlaybackMachine::class); } - public function preservationInstance() + public function preservationInstance(): BelongsTo { return $this->belongsTo(\Jitterbug\Models\PreservationInstance::class); } - public function vendor() + public function vendor(): BelongsTo { return $this->belongsTo(\Jitterbug\Models\Vendor::class); } - public function subclass() + public function subclass(): MorphTo { return $this->morphTo(); } diff --git a/app/Models/TransferCollection.php b/app/Models/TransferCollection.php index 0403ff1f..03954566 100644 --- a/app/Models/TransferCollection.php +++ b/app/Models/TransferCollection.php @@ -4,6 +4,4 @@ use Illuminate\Database\Eloquent\Model; -class TransferCollection extends Model -{ -} +class TransferCollection extends Model {} diff --git a/app/Models/TransferFormat.php b/app/Models/TransferFormat.php index f5cd97eb..3e161a39 100644 --- a/app/Models/TransferFormat.php +++ b/app/Models/TransferFormat.php @@ -4,6 +4,4 @@ use Illuminate\Database\Eloquent\Model; -class TransferFormat extends Model -{ -} +class TransferFormat extends Model {} diff --git a/app/Models/TransferType.php b/app/Models/TransferType.php index 6b7613bf..8fc47adf 100644 --- a/app/Models/TransferType.php +++ b/app/Models/TransferType.php @@ -8,6 +8,4 @@ * Simple model for displaying type filters in the Transfers * section of the application. The underlying database object is a view. */ -class TransferType extends Model -{ -} +class TransferType extends Model {} diff --git a/app/Models/User.php b/app/Models/User.php index 412d4f1f..e1a88024 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -2,20 +2,21 @@ namespace Jitterbug\Models; +use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract; +use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; +use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract; use Illuminate\Database\Eloquent\Factories\HasFactory; +use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Foundation\Auth\Access\Authorizable; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; -use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract; -use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; -use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract; use Illuminate\Support\Arr; -use LdapRecord\Laravel\Auth\LdapAuthenticatable; use LdapRecord\Laravel\Auth\AuthenticatesWithLdap; +use LdapRecord\Laravel\Auth\LdapAuthenticatable; -class User extends Authenticatable implements LdapAuthenticatable, AuthenticatableContract, AuthorizableContract, CanResetPasswordContract +class User extends Authenticatable implements AuthenticatableContract, AuthorizableContract, CanResetPasswordContract, LdapAuthenticatable { - use Notifiable, Authorizable, AuthenticatesWithLdap, HasFactory; + use AuthenticatesWithLdap, Authorizable, HasFactory, Notifiable; /** * The database table used by the model. @@ -46,7 +47,7 @@ public function isAdmin() /** * Return the marks for this user. */ - public function marks() + public function marks(): HasMany { return $this->hasMany(\Jitterbug\Models\Mark::class); } @@ -96,9 +97,6 @@ public function getLdapGuidColumn(): string /** * Return a list of engineer users, suitable for use in dropdown * menus. - * - * @param $originalUserId - * @return array */ public static function engineerList($originalUserId = null): array { @@ -144,4 +142,4 @@ public function legacy() { return $this->legacy_initials !== null; } -} \ No newline at end of file +} diff --git a/app/Models/Vendor.php b/app/Models/Vendor.php index 413b8456..1d8cbe0b 100644 --- a/app/Models/Vendor.php +++ b/app/Models/Vendor.php @@ -8,9 +8,9 @@ class Vendor extends Model { + use HasFactory; use NullFieldPreserver; use SoftDeletes; - use HasFactory; protected $fillable = ['name']; diff --git a/app/Presenters/ActivityStream.php b/app/Presenters/ActivityStream.php index aab8c750..842a106c 100644 --- a/app/Presenters/ActivityStream.php +++ b/app/Presenters/ActivityStream.php @@ -28,10 +28,10 @@ public function generate() // Fetch recent transaction ids $results = DB::table('revisions')->select('transaction_id') - ->distinct() - ->orderBy('id', 'desc') - ->limit($numTransactionsToDigest) - ->get(); + ->distinct() + ->orderBy('id', 'desc') + ->limit($numTransactionsToDigest) + ->get(); // Digest the transactions $digests = []; @@ -72,18 +72,18 @@ private function hasNewTransactions(): bool // Fetch last transaction made in the revisions table // Each batch of revisions will have the same transaction ID $results = DB::table('revisions')->select('transaction_id') - ->orderBy('id', 'desc') - ->limit(1) - ->get()->all(); + ->orderBy('id', 'desc') + ->limit(1) + ->get()->all(); $lastRevisionTransactionId = $results[0]->transaction_id; // Fetch most recent transaction in the activities table // The smallest ID is the most recently done activity $results = DB::table('activities')->select('transaction_id') - ->orderBy('id', 'asc') - ->limit(1) - ->get()->all(); + ->orderBy('id', 'asc') + ->limit(1) + ->get()->all(); if (count($results) === 0) { return true; diff --git a/app/Presenters/DashboardMark.php b/app/Presenters/DashboardMark.php index af67f239..4e0482f9 100644 --- a/app/Presenters/DashboardMark.php +++ b/app/Presenters/DashboardMark.php @@ -70,7 +70,7 @@ public function objectType() public function timestamp() { - $timeAgo = new TimeAgo(); + $timeAgo = new TimeAgo; return $timeAgo->inWordsFromStrings($this->mark->updated_at); } diff --git a/app/Presenters/TransactionDigest.php b/app/Presenters/TransactionDigest.php index 8fc2783a..0792c7d2 100644 --- a/app/Presenters/TransactionDigest.php +++ b/app/Presenters/TransactionDigest.php @@ -142,8 +142,8 @@ public function __construct($transactionId) $this->transactionId = $transactionId; // Order revisions by most recent, which is important for analysis $this->revisions = Revision::where('transaction_id', $transactionId) - ->orderBy('id', 'desc') - ->get(); + ->orderBy('id', 'desc') + ->get(); $this->associatedImportTransaction = ImportTransaction::where('transaction_id', $transactionId)->first(); $this->analyzeRevisions(); $this->generateActivities(); @@ -395,6 +395,7 @@ protected function findAssociatedItemType() if ($this->associatedItem) { $this->associatedItemType = strtolower($this->associatedItem->type); + return $this->associatedItemType; } @@ -503,10 +504,10 @@ protected function computeImportSize() // by grouping the same revision types together and their revisionable IDs // we are only counting revisions for PreservationInstances, AudioVisualItems, and AudioItems $uniqueRevisionsCount = Revision::where('transaction_id', $this->transactionId) - ->groupBy('revisionable_type', 'revisionable_id') - ->whereIn('revisionable_type', ['PreservationInstance', 'AudioItem', 'AudioVisualItem']) - ->get() - ->count(); + ->groupBy('revisionable_type', 'revisionable_id') + ->whereIn('revisionable_type', ['PreservationInstance', 'AudioItem', 'AudioVisualItem']) + ->get() + ->count(); $this->batchSize = $uniqueRevisionsCount; } diff --git a/app/Presenters/TypeCounts.php b/app/Presenters/TypeCounts.php index 30d0bde0..d0d41726 100644 --- a/app/Presenters/TypeCounts.php +++ b/app/Presenters/TypeCounts.php @@ -21,8 +21,8 @@ class TypeCounts * AudioVisualItemType, PreservationInstanceType or * TransferType. * - * @param \Illuminate\Support\Collection $types Collection of - * AudioVisualItemType, PreservationInstanceType, or TransferType. + * @param \Illuminate\Support\Collection $types Collection of + * AudioVisualItemType, PreservationInstanceType, or TransferType. */ public function __construct($types) { diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index f21615b3..4ce5461c 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -24,10 +24,8 @@ class AppServiceProvider extends ServiceProvider { /** * Bootstrap any application services. - * - * @return void */ - public function boot() + public function boot(): void { // For legacy support of Jitterbug, keep resource parameters plural Route::singularResourceParameters(false); @@ -69,10 +67,8 @@ public function boot() /** * Register any application services. - * - * @return void */ - public function register() + public function register(): void { require_once __DIR__.'/../Http/helpers.php'; } diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php deleted file mode 100644 index a8e1a1d2..00000000 --- a/app/Providers/AuthServiceProvider.php +++ /dev/null @@ -1,29 +0,0 @@ - 'Jitterbug\Policies\ModelPolicy', - ]; - - /** - * Register any authentication / authorization services. - * - * @return void - */ - public function boot() - { - $this->registerPolicies(); - - // - } -} diff --git a/app/Providers/BroadcastServiceProvider.php b/app/Providers/BroadcastServiceProvider.php deleted file mode 100644 index bc19be56..00000000 --- a/app/Providers/BroadcastServiceProvider.php +++ /dev/null @@ -1,26 +0,0 @@ -id === (int) $userId; - }); - } -} diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php deleted file mode 100644 index 98862638..00000000 --- a/app/Providers/EventServiceProvider.php +++ /dev/null @@ -1,42 +0,0 @@ - [ - 'Jitterbug\Listeners\EventListener', - ], - ]; - - /** - * Register any events for your application. - * - * @return void - */ - public function boot() - { - parent::boot(); - - // - } - - /** - * Determine if events and listeners should be automatically discovered. - * - * @return bool - */ - public function shouldDiscoverEvents() - { - return false; - } -} diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 3b9742be..d35c1a3e 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -17,10 +17,8 @@ class RouteServiceProvider extends ServiceProvider /** * Define your route model bindings, pattern filters, etc. - * - * @return void */ - public function boot() + public function boot(): void { parent::boot(); @@ -50,10 +48,7 @@ public function map() */ protected function mapWebRoutes() { - Route::group([ - 'middleware' => 'web', - 'namespace' => $this->namespace, - ], function ($router) { + Route::middleware('web')->group(function ($router) { require base_path('routes/web.php'); }); } @@ -67,11 +62,7 @@ protected function mapWebRoutes() */ protected function mapApiRoutes() { - Route::group([ - 'middleware' => 'api', - 'namespace' => $this->namespace, - 'prefix' => 'api', - ], function ($router) { + Route::middleware('api')->prefix('api')->group(function ($router) { require base_path('routes/api.php'); }); } diff --git a/app/Support/SolariumPaginator.php b/app/Support/SolariumPaginator.php index 2649d1e8..332619c7 100644 --- a/app/Support/SolariumPaginator.php +++ b/app/Support/SolariumPaginator.php @@ -7,7 +7,7 @@ /* * Pagination support for Solarium result sets. */ -class SolariumPaginator implements \IteratorAggregate, \Countable +class SolariumPaginator implements \Countable, \IteratorAggregate { /** * The current page being viewed. diff --git a/app/Support/SolariumProxy.php b/app/Support/SolariumProxy.php index e25a40c1..eebd6aa3 100644 --- a/app/Support/SolariumProxy.php +++ b/app/Support/SolariumProxy.php @@ -34,8 +34,8 @@ protected function clientFor($core) $endpointConfig = $config[$endpointKeys[0]]; $hostKeys = array_keys($endpointConfig); $config[$endpointKeys[0]][$hostKeys[0]]['core'] = $core; - $adapter = new Solarium\Core\Client\Adapter\Curl(); - $eventDispatcher = new Symfony\Component\EventDispatcher\EventDispatcher(); + $adapter = new Solarium\Core\Client\Adapter\Curl; + $eventDispatcher = new Symfony\Component\EventDispatcher\EventDispatcher; return new Solarium\Client($adapter, $eventDispatcher, $config); } diff --git a/app/Util/CsvReader.php b/app/Util/CsvReader.php index e5cbebc8..364cecf0 100644 --- a/app/Util/CsvReader.php +++ b/app/Util/CsvReader.php @@ -9,7 +9,7 @@ class CsvReader /** * Create a new CsvReader instance. * - * @param string $filePath The path to the csv file to parse. + * @param string $filePath The path to the csv file to parse. * @return void */ public function __construct($filePath) @@ -21,8 +21,8 @@ public function __construct($filePath) * For each row, return an array of key/value pairs for the * given keys. * - * @param array $keys Array of keys to fetch data for. Keys should - * be heading names in the CSV file. + * @param array $keys Array of keys to fetch data for. Keys should + * be heading names in the CSV file. * @return array */ public function fetchKeys($keys) diff --git a/artisan b/artisan index eb5e2bb6..8e04b422 100755 --- a/artisan +++ b/artisan @@ -1,51 +1,15 @@ #!/usr/bin/env php make('Illuminate\Contracts\Console\Kernel'); - -$status = $kernel->handle( - $input = new Symfony\Component\Console\Input\ArgvInput, - new Symfony\Component\Console\Output\ConsoleOutput -); - -/* -|-------------------------------------------------------------------------- -| Shutdown The Application -|-------------------------------------------------------------------------- -| -| Once Artisan has finished running. We will fire off the shutdown events -| so that any final work may be done by the application before we shut -| down the process. This is the last thing to happen to the request. -| -*/ - -$kernel->terminate($input, $status); +// Bootstrap Laravel and handle the command... +$status = (require_once __DIR__.'/bootstrap/app.php') + ->handleCommand(new ArgvInput); exit($status); diff --git a/bootstrap/app.php b/bootstrap/app.php index 231996f3..4565d6a1 100644 --- a/bootstrap/app.php +++ b/bootstrap/app.php @@ -1,55 +1,43 @@ singleton( - 'Illuminate\Contracts\Http\Kernel', - 'Jitterbug\Http\Kernel' -); - -$app->singleton( - 'Illuminate\Contracts\Console\Kernel', - 'Jitterbug\Console\Kernel' -); - -$app->singleton( - 'Illuminate\Contracts\Debug\ExceptionHandler', - 'Jitterbug\Exceptions\Handler' -); - -/* -|-------------------------------------------------------------------------- -| Return The Application -|-------------------------------------------------------------------------- -| -| This script returns the application instance. The instance is given to -| the calling script so we can separate the building of the instances -| from the actual running of the application and sending responses. -| -*/ - -return $app; +use Illuminate\Foundation\Application; +use Illuminate\Foundation\Configuration\Exceptions; +use Illuminate\Foundation\Configuration\Middleware; + +return Application::configure(basePath: dirname(__DIR__)) + ->withProviders([ + \Laravel\Tinker\TinkerServiceProvider::class, + \Diglactic\Breadcrumbs\ServiceProvider::class, + \Venturecraft\Revisionable\RevisionableServiceProvider::class, + ]) + ->withRouting( + web: __DIR__.'/../routes/web.php', + // api: __DIR__.'/../routes/api.php', + commands: __DIR__.'/../routes/console.php', + // channels: __DIR__.'/../routes/channels.php', + health: '/up', + ) + ->withMiddleware(function (Middleware $middleware) { + $middleware->encryptCookies(except: [ + 'referrer', + ]); + + $middleware->append(\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class); + + $middleware->web([ + \Jitterbug\Http\Middleware\EncryptCookies::class, + \Jitterbug\Http\Middleware\VerifyCsrfToken::class, + ]); + + $middleware->throttleApi('60,1'); + + $middleware->alias([ + 'admin' => \Jitterbug\Http\Middleware\Admin::class, + 'auth' => \Jitterbug\Http\Middleware\Authenticate::class, + 'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class, + 'guest' => \Jitterbug\Http\Middleware\RedirectIfAuthenticated::class, + ]); + }) + ->withExceptions(function (Exceptions $exceptions) { + // + })->create(); diff --git a/bootstrap/providers.php b/bootstrap/providers.php new file mode 100644 index 00000000..a6222ab3 --- /dev/null +++ b/bootstrap/providers.php @@ -0,0 +1,6 @@ + 'Jitterbug', - - /* - |-------------------------------------------------------------------------- - | Application Environment - |-------------------------------------------------------------------------- - | - | This value determines the "environment" your application is currently - | running in. This may determine how you prefer to configure various - | services your application utilizes. Set this in your ".env" file. - | - */ - - 'env' => env('APP_ENV', 'production'), - - /* - |-------------------------------------------------------------------------- - | Application Debug Mode - |-------------------------------------------------------------------------- - | - | When your application is in debug mode, detailed error messages with - | stack traces will be shown on every error that occurs within your - | application. If disabled, a simple generic error page is shown. - | - */ - - 'debug' => env('APP_DEBUG'), - - /* - |-------------------------------------------------------------------------- - | Application URL - |-------------------------------------------------------------------------- - | - | This URL is used by the console to properly generate URLs when using - | the Artisan command line tool. You should set this to the root of - | your application so that it is used when running Artisan tasks. - | - */ - - 'url' => 'http://localhost', - - /* - |-------------------------------------------------------------------------- - | Application Timezone - |-------------------------------------------------------------------------- - | - | Here you may specify the default timezone for your application, which - | will be used by the PHP date and date-time functions. We have gone - | ahead and set this to a sensible default for you out of the box. - | - */ - - 'timezone' => 'UTC', - - /* - |-------------------------------------------------------------------------- - | Application Locale Configuration - |-------------------------------------------------------------------------- - | - | The application locale determines the default locale that will be used - | by the translation service provider. You are free to set this value - | to any of the locales which will be supported by the application. - | - */ - - 'locale' => 'en', - - /* - |-------------------------------------------------------------------------- - | Application Fallback Locale - |-------------------------------------------------------------------------- - | - | The fallback locale determines the locale to use when the current one - | is not available. You may change the value to correspond to any of - | the language folders that are provided through your application. - | - */ - - 'fallback_locale' => 'en', - - /* - |-------------------------------------------------------------------------- - | Encryption Key - |-------------------------------------------------------------------------- - | - | This key is used by the Illuminate encrypter service and should be set - | to a random, 32 character string, otherwise these encrypted strings - | will not be safe. Please do this before deploying an application! - | - */ - - 'key' => env('APP_KEY'), - - 'cipher' => 'AES-256-CBC', - - /* - |-------------------------------------------------------------------------- - | Maintenance Mode Driver - |-------------------------------------------------------------------------- - | - | These configuration options determine the driver used to determine and - | manage Laravel's "maintenance mode" status. The "cache" driver will - | allow maintenance mode to be controlled across multiple machines. - | - | Supported drivers: "file", "cache" - | - */ - - 'maintenance' => [ - 'driver' => 'file', - // 'store' => 'redis', - ], - - /* - |-------------------------------------------------------------------------- - | Autoloaded Service Providers - |-------------------------------------------------------------------------- - | - | The service providers listed here will be automatically loaded on the - | request to your application. Feel free to add your own services to - | this array to grant expanded functionality to your applications. - | - */ - - 'providers' => [ - - /* - * Laravel Framework Service Providers... - */ - 'Illuminate\Auth\AuthServiceProvider', - 'Illuminate\Broadcasting\BroadcastServiceProvider', - 'Illuminate\Bus\BusServiceProvider', - 'Illuminate\Cache\CacheServiceProvider', - 'Illuminate\Foundation\Providers\ConsoleSupportServiceProvider', - 'Illuminate\Cookie\CookieServiceProvider', - 'Illuminate\Database\DatabaseServiceProvider', - 'Illuminate\Encryption\EncryptionServiceProvider', - 'Illuminate\Filesystem\FilesystemServiceProvider', - 'Illuminate\Foundation\Providers\FoundationServiceProvider', - 'Illuminate\Hashing\HashServiceProvider', - 'Illuminate\Mail\MailServiceProvider', - 'Illuminate\Notifications\NotificationServiceProvider', - 'Illuminate\Pagination\PaginationServiceProvider', - 'Illuminate\Pipeline\PipelineServiceProvider', - 'Illuminate\Queue\QueueServiceProvider', - 'Illuminate\Redis\RedisServiceProvider', - 'Illuminate\Auth\Passwords\PasswordResetServiceProvider', - 'Illuminate\Session\SessionServiceProvider', - 'Illuminate\Translation\TranslationServiceProvider', - 'Illuminate\Validation\ValidationServiceProvider', - 'Illuminate\View\ViewServiceProvider', - 'Laravel\Tinker\TinkerServiceProvider', - - /* - * Application Service Providers... - */ - Jitterbug\Providers\AppServiceProvider::class, - Jitterbug\Providers\AuthServiceProvider::class, - // 'Jitterbug\Providers\BroadcastServiceProvider', - Jitterbug\Providers\EventServiceProvider::class, - Jitterbug\Providers\RouteServiceProvider::class, - - /* - * Third-party Service Providers - */ - // Comes from diglactic/laravel-breadcrumbs (^7.0) - Diglactic\Breadcrumbs\ServiceProvider::class, - 'Venturecraft\Revisionable\RevisionableServiceProvider', - - ], - - /* - |-------------------------------------------------------------------------- - | Class Aliases - |-------------------------------------------------------------------------- - | - | This array of class aliases will be registered when this application - | is started. However, feel free to register as many as you wish as - | the aliases are "lazy" loaded so they don't hinder performance. - | - */ 'aliases' => Facade::defaultAliases()->merge([ 'AudioInstance' => Jitterbug\Models\AudioInstance::class, diff --git a/config/auth.php b/config/auth.php index fd5929de..4e7c6720 100644 --- a/config/auth.php +++ b/config/auth.php @@ -2,39 +2,6 @@ return [ - /* - |-------------------------------------------------------------------------- - | Authentication Defaults - |-------------------------------------------------------------------------- - | - | This option controls the default authentication "guard" and password - | reset options for your application. You may change these defaults - | as required, but they're a perfect start for most applications. - | - */ - - 'defaults' => [ - 'guard' => 'web', - 'passwords' => 'users', - ], - - /* - |-------------------------------------------------------------------------- - | Authentication Guards - |-------------------------------------------------------------------------- - | - | Next, you may define every authentication guard for your application. - | Of course, a great default configuration has been defined for you - | here which uses session storage and the Eloquent user provider. - | - | All authentication drivers have a user provider. This defines how the - | users are actually retrieved out of your database or other storage - | mechanisms used by this application to persist your user's data. - | - | Supported: "session" - | - */ - 'guards' => [ 'web' => [ 'driver' => 'session', @@ -47,30 +14,13 @@ ], ], - /* - |-------------------------------------------------------------------------- - | User Providers - |-------------------------------------------------------------------------- - | - | All authentication drivers have a user provider. This defines how the - | users are actually retrieved out of your database or other storage - | mechanisms used by this application to persist your user's data. - | - | If you have multiple user tables or models you may configure multiple - | sources which represent each model / table. These sources may then - | be assigned to any extra authentication guards you have defined. - | - | Supported: "database", "eloquent" - | - */ - 'providers' => [ 'ldap' => [ 'driver' => 'ldap', 'rules' => [], 'model' => LdapRecord\Models\ActiveDirectory\User::class, 'scopes' => [ - Jitterbug\Scopes\AdldapLimitationScope::class + Jitterbug\Scopes\AdldapLimitationScope::class, ], 'database' => [ 'model' => Jitterbug\Models\User::class, @@ -84,35 +34,15 @@ 'sync_existing' => [ 'username' => 'samaccountname', ], - ] + ], ], 'users' => [ 'driver' => env('APP_AUTH', 'ldap'), 'model' => Jitterbug\Models\User::class, ], - - // 'users' => [ - // 'driver' => 'database', - // 'table' => 'users', - // ], ], - /* - |-------------------------------------------------------------------------- - | Resetting Passwords - |-------------------------------------------------------------------------- - | - | You may specify multiple password reset configurations if you have more - | than one user table or model in the application and you want to have - | separate password reset settings based on the specific user types. - | - | The expire time is the number of minutes that each reset token will be - | considered valid. This security feature keeps tokens short-lived so - | they have less time to be guessed. You may change this as needed. - | - */ - 'passwords' => [ 'users' => [ 'provider' => 'users', @@ -123,17 +53,4 @@ ], ], - /* - |-------------------------------------------------------------------------- - | Password Confirmation Timeout - |-------------------------------------------------------------------------- - | - | Here you may define the amount of seconds before a password confirmation - | times out and the user is prompted to re-enter their password via the - | confirmation screen. By default, the timeout lasts for three hours. - | - */ - - 'password_timeout' => 10800, - -]; \ No newline at end of file +]; diff --git a/config/broadcasting.php b/config/broadcasting.php deleted file mode 100644 index 16882424..00000000 --- a/config/broadcasting.php +++ /dev/null @@ -1,70 +0,0 @@ - env('BROADCAST_DRIVER', 'null'), - - /* - |-------------------------------------------------------------------------- - | Broadcast Connections - |-------------------------------------------------------------------------- - | - | Here you may define all of the broadcast connections that will be used - | to broadcast events to other systems or over websockets. Samples of - | each available type of connection are provided inside this array. - | - */ - - 'connections' => [ - - 'pusher' => [ - 'driver' => 'pusher', - 'key' => env('PUSHER_APP_KEY'), - 'secret' => env('PUSHER_APP_SECRET'), - 'app_id' => env('PUSHER_APP_ID'), - 'options' => [ - 'host' => env('PUSHER_HOST', 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com', - 'port' => env('PUSHER_PORT', 443), - 'scheme' => env('PUSHER_SCHEME', 'https'), - 'encrypted' => true, - 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https', - ], - 'client_options' => [ - // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html - ], - ], - - 'ably' => [ - 'driver' => 'ably', - 'key' => env('ABLY_KEY'), - ], - - 'redis' => [ - 'driver' => 'redis', - 'connection' => 'default', - ], - - 'log' => [ - 'driver' => 'log', - ], - - 'null' => [ - 'driver' => 'null', - ], - - ], - -]; diff --git a/config/cache.php b/config/cache.php index 7b3df957..9e3136c1 100644 --- a/config/cache.php +++ b/config/cache.php @@ -1,110 +1,12 @@ env('CACHE_DRIVER', 'file'), - - /* - |-------------------------------------------------------------------------- - | Cache Stores - |-------------------------------------------------------------------------- - | - | Here you may define all of the cache "stores" for your application as - | well as their drivers. You may even define multiple stores for the - | same cache driver to group types of items stored in your caches. - | - | Supported drivers: "apc", "array", "database", "file", - | "memcached", "redis", "dynamodb", "octane", "null" - | - */ - 'stores' => [ - - 'apc' => [ - 'driver' => 'apc', - ], - - 'array' => [ - 'driver' => 'array', - 'serialize' => false, - ], - - 'database' => [ - 'driver' => 'database', - 'table' => 'cache', - 'connection' => null, - 'lock_connection' => null, - ], - 'file' => [ 'driver' => 'file', 'path' => env('STORAGE_PATH', storage_path()).'/framework/cache', ], - - 'memcached' => [ - 'driver' => 'memcached', - 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), - 'sasl' => [ - env('MEMCACHED_USERNAME'), - env('MEMCACHED_PASSWORD'), - ], - 'options' => [ - // Memcached::OPT_CONNECT_TIMEOUT => 2000, - ], - 'servers' => [ - [ - 'host' => env('MEMCACHED_HOST', '127.0.0.1'), - 'port' => env('MEMCACHED_PORT', 11211), - 'weight' => 100, - ], - ], - ], - - 'redis' => [ - 'driver' => 'redis', - 'connection' => 'default', - 'lock_connection' => 'default', - ], - - 'dynamodb' => [ - 'driver' => 'dynamodb', - 'key' => env('AWS_ACCESS_KEY_ID'), - 'secret' => env('AWS_SECRET_ACCESS_KEY'), - 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), - 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), - 'endpoint' => env('DYNAMODB_ENDPOINT'), - ], - - 'octane' => [ - 'driver' => 'octane', - ], - ], - /* - |-------------------------------------------------------------------------- - | Cache Key Prefix - |-------------------------------------------------------------------------- - | - | When utilizing the APC, database, memcached, Redis, or DynamoDB cache - | stores there might be other applications using the same cache. For - | that reason, you may prefix every cache key to avoid collisions. - | - */ - - 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'), - ]; diff --git a/config/cors.php b/config/cors.php deleted file mode 100644 index 8a39e6da..00000000 --- a/config/cors.php +++ /dev/null @@ -1,34 +0,0 @@ - ['api/*', 'sanctum/csrf-cookie'], - - 'allowed_methods' => ['*'], - - 'allowed_origins' => ['*'], - - 'allowed_origins_patterns' => [], - - 'allowed_headers' => ['*'], - - 'exposed_headers' => [], - - 'max_age' => 0, - - 'supports_credentials' => false, - -]; diff --git a/config/database.php b/config/database.php index a8b8a404..de5982b5 100644 --- a/config/database.php +++ b/config/database.php @@ -2,50 +2,9 @@ return [ - /* - |-------------------------------------------------------------------------- - | PDO Fetch Style - |-------------------------------------------------------------------------- - | - | By default, database results will be returned as instances of the PHP - | stdClass object; however, you may desire to retrieve records in an - | array format for simplicity. Here you can tweak the fetch style. - | - */ - 'fetch' => PDO::FETCH_CLASS, - /* - |-------------------------------------------------------------------------- - | Default Database Connection Name - |-------------------------------------------------------------------------- - | - | Here you may specify which of the database connections below you wish - | to use as your default connection for all database work. Of course - | you may use many connections at once using the Database library. - | - */ - - 'default' => 'mysql', - - /* - |-------------------------------------------------------------------------- - | Database Connections - |-------------------------------------------------------------------------- - | - | Here are each of the database connections setup for your application. - | Of course, examples of configuring each database platform that is - | supported by Laravel is shown below to make development simple. - | - | - | All database work in Laravel is done through the PHP PDO facilities - | so make sure you have the driver for your particular database of - | choice installed on your machine before you begin development. - | - */ - 'connections' => [ - 'sqlite' => [ 'driver' => 'sqlite', 'database' => storage_path().'/database.sqlite', @@ -63,52 +22,12 @@ 'prefix' => '', 'strict' => false, ], - - 'pgsql' => [ - 'driver' => 'pgsql', - 'host' => env('DB_HOST', 'localhost'), - 'database' => env('DB_DATABASE', 'forge'), - 'username' => env('DB_USERNAME', 'forge'), - 'password' => env('DB_PASSWORD', ''), - 'charset' => 'utf8', - 'prefix' => '', - 'search_path' => 'public', - ], - - 'sqlsrv' => [ - 'driver' => 'sqlsrv', - 'host' => env('DB_HOST', 'localhost'), - 'database' => env('DB_DATABASE', 'forge'), - 'username' => env('DB_USERNAME', 'forge'), - 'password' => env('DB_PASSWORD', ''), - 'prefix' => '', - ], - ], - /* - |-------------------------------------------------------------------------- - | Migration Repository Table - |-------------------------------------------------------------------------- - | - | This table keeps track of all the migrations that have already run for - | your application. Using this information, we can determine which of - | the migrations on disk haven't actually been run in the database. - | - */ - - 'migrations' => 'migrations', - - /* - |-------------------------------------------------------------------------- - | Redis Databases - |-------------------------------------------------------------------------- - | - | Redis is an open source, fast, and advanced key-value store that also - | provides a richer set of commands than a typical key-value systems - | such as APC or Memcached. Laravel makes it easy to dig right in. - | - */ + 'migrations' => [ + 'table' => 'migrations', + 'update_date_on_publish' => false, // disable to preserve original behavior for existing applications + ], 'redis' => [ diff --git a/config/filesystems.php b/config/filesystems.php index 277d035a..fb8365e1 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -2,62 +2,15 @@ return [ - /* - |-------------------------------------------------------------------------- - | Default Filesystem Disk - |-------------------------------------------------------------------------- - | - | Here you may specify the default filesystem disk that should be used - | by the framework. The "local" disk, as well as a variety of cloud - | based disks are available to your application. Just store away! - | - */ - - 'default' => env('FILESYSTEM_DISK', 'local'), - 'cloud' => 's3', - /* - |-------------------------------------------------------------------------- - | Filesystem Disks - |-------------------------------------------------------------------------- - | - | Here you may configure as many filesystem "disks" as you wish, and you - | may even configure multiple disks of the same driver. Defaults have - | been set up for each driver as an example of the required values. - | - | Supported Drivers: "local", "ftp", "sftp", "s3" - | - */ - 'disks' => [ - 'local' => [ 'driver' => 'local', 'root' => env('STORAGE_PATH', storage_path()).'/app', 'throw' => false, ], - 'public' => [ - 'driver' => 'local', - 'root' => storage_path('app/public'), - 'url' => env('APP_URL').'/storage', - 'visibility' => 'public', - 'throw' => false, - ], - - 's3' => [ - 'driver' => 's3', - 'key' => env('AWS_ACCESS_KEY_ID'), - 'secret' => env('AWS_SECRET_ACCESS_KEY'), - 'region' => env('AWS_DEFAULT_REGION'), - 'bucket' => env('AWS_BUCKET'), - 'url' => env('AWS_URL'), - 'endpoint' => env('AWS_ENDPOINT'), - 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), - 'throw' => false, - ], - 'rackspace' => [ 'driver' => 'rackspace', 'username' => 'your-username', @@ -67,22 +20,6 @@ 'region' => 'IAD', 'url_type' => 'publicURL', ], - - ], - - /* - |-------------------------------------------------------------------------- - | Symbolic Links - |-------------------------------------------------------------------------- - | - | Here you may configure the symbolic links that will be created when the - | `storage:link` Artisan command is executed. The array keys should be - | the locations of the links and the values should be their targets. - | - */ - - 'links' => [ - public_path('storage') => storage_path('app/public'), ], ]; diff --git a/config/hashing.php b/config/hashing.php deleted file mode 100644 index bcd3be4c..00000000 --- a/config/hashing.php +++ /dev/null @@ -1,52 +0,0 @@ - 'bcrypt', - - /* - |-------------------------------------------------------------------------- - | Bcrypt Options - |-------------------------------------------------------------------------- - | - | Here you may specify the configuration options that should be used when - | passwords are hashed using the Bcrypt algorithm. This will allow you - | to control the amount of time it takes to hash the given password. - | - */ - - 'bcrypt' => [ - 'rounds' => env('BCRYPT_ROUNDS', 10), - ], - - /* - |-------------------------------------------------------------------------- - | Argon Options - |-------------------------------------------------------------------------- - | - | Here you may specify the configuration options that should be used when - | passwords are hashed using the Argon algorithm. These will allow you - | to control the amount of time it takes to hash the given password. - | - */ - - 'argon' => [ - 'memory' => 65536, - 'threads' => 1, - 'time' => 4, - ], - -]; diff --git a/config/ldap.php b/config/ldap.php index 8960932f..585cb02c 100644 --- a/config/ldap.php +++ b/config/ldap.php @@ -67,7 +67,7 @@ 'cache' => [ 'enabled' => env('LDAP_CACHE', false), - 'driver' => env('CACHE_DRIVER', 'file'), + 'driver' => env('CACHE_STORE', 'file'), ], -]; \ No newline at end of file +]; diff --git a/config/logging.php b/config/logging.php index 77e433e5..67d3436a 100644 --- a/config/logging.php +++ b/config/logging.php @@ -1,122 +1,13 @@ env('LOG_CHANNEL', 'stack'), - - /* - |-------------------------------------------------------------------------- - | Deprecations Log Channel - |-------------------------------------------------------------------------- - | - | This option controls the log channel that should be used to log warnings - | regarding deprecated PHP and library features. This allows you to get - | your application ready for upcoming major versions of dependencies. - | - */ - - 'deprecations' => [ - 'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'), - 'trace' => false, - ], - - /* - |-------------------------------------------------------------------------- - | Log Channels - |-------------------------------------------------------------------------- - | - | Here you may configure the log channels for your application. Out of - | the box, Laravel uses the Monolog PHP logging library. This gives - | you a variety of powerful log handlers / formatters to utilize. - | - | Available Drivers: "single", "daily", "slack", "syslog", - | "errorlog", "monolog", - | "custom", "stack" - | - */ - 'channels' => [ - 'stack' => [ - 'driver' => 'stack', - 'channels' => ['daily'], - 'ignore_exceptions' => false, - ], - 'single' => [ 'driver' => 'single', 'path' => env('LOG_CHANNEL_PATH', storage_path('logs/laravel.log')), 'level' => env('LOG_LEVEL', 'debug'), ], - - 'daily' => [ - 'driver' => 'daily', - 'path' => storage_path('logs/laravel.log'), - 'level' => env('LOG_LEVEL', 'debug'), - 'days' => 7, - ], - - 'slack' => [ - 'driver' => 'slack', - 'url' => env('LOG_SLACK_WEBHOOK_URL'), - 'username' => 'Laravel Log', - 'emoji' => ':boom:', - 'level' => env('LOG_LEVEL', 'critical'), - ], - - 'papertrail' => [ - 'driver' => 'monolog', - 'level' => env('LOG_LEVEL', 'debug'), - 'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class), - 'handler_with' => [ - 'host' => env('PAPERTRAIL_URL'), - 'port' => env('PAPERTRAIL_PORT'), - 'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'), - ], - ], - - 'stderr' => [ - 'driver' => 'monolog', - 'level' => env('LOG_LEVEL', 'debug'), - 'handler' => StreamHandler::class, - 'formatter' => env('LOG_STDERR_FORMATTER'), - 'with' => [ - 'stream' => 'php://stderr', - ], - ], - - 'syslog' => [ - 'driver' => 'syslog', - 'level' => env('LOG_LEVEL', 'debug'), - ], - - 'errorlog' => [ - 'driver' => 'errorlog', - 'level' => env('LOG_LEVEL', 'debug'), - ], - - 'null' => [ - 'driver' => 'monolog', - 'handler' => NullHandler::class, - ], - - 'emergency' => [ - 'path' => storage_path('logs/laravel.log'), - ], ], ]; diff --git a/config/mail.php b/config/mail.php index 534395a3..44352036 100644 --- a/config/mail.php +++ b/config/mail.php @@ -2,111 +2,12 @@ return [ - /* - |-------------------------------------------------------------------------- - | Default Mailer - |-------------------------------------------------------------------------- - | - | This option controls the default mailer that is used to send any email - | messages sent by your application. Alternative mailers may be setup - | and used as needed; however, this mailer will be used by default. - | - */ - - 'default' => env('MAIL_MAILER', 'smtp'), - - /* - |-------------------------------------------------------------------------- - | Mailer Configurations - |-------------------------------------------------------------------------- - | - | Here you may configure all of the mailers used by your application plus - | their respective settings. Several examples have been configured for - | you and you are free to add your own as your application requires. - | - | Laravel supports a variety of mail "transport" drivers to be used while - | sending an e-mail. You will specify which one you are using for your - | mailers below. You are free to add additional mailers as required. - | - | Supported: "smtp", "sendmail", "mailgun", "ses", - | "postmark", "log", "array", "failover" - | - */ - 'mailers' => [ - 'smtp' => [ - 'transport' => 'smtp', - 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), - 'port' => env('MAIL_PORT', 587), - 'encryption' => env('MAIL_ENCRYPTION', 'tls'), - 'username' => env('MAIL_USERNAME'), - 'password' => env('MAIL_PASSWORD'), - 'timeout' => null, - 'local_domain' => env('MAIL_EHLO_DOMAIN'), - ], - - 'ses' => [ - 'transport' => 'ses', - ], - 'mailgun' => [ 'transport' => 'mailgun', ], - - 'postmark' => [ - 'transport' => 'postmark', - ], - - 'sendmail' => [ - 'transport' => 'sendmail', - 'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'), - ], - - 'log' => [ - 'transport' => 'log', - 'channel' => env('MAIL_LOG_CHANNEL'), - ], - - 'array' => [ - 'transport' => 'array', - ], - - 'failover' => [ - 'transport' => 'failover', - 'mailers' => [ - 'smtp', - 'log', - ], - ], ], - /* - |-------------------------------------------------------------------------- - | Global "From" Address - |-------------------------------------------------------------------------- - | - | You may wish for all e-mails sent by your application to be sent from - | the same address. Here, you may specify a name and address that is - | used globally for all e-mails that are sent by your application. - | - */ - - 'from' => [ - 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), - 'name' => env('MAIL_FROM_NAME', 'Example'), - ], - - /* - |-------------------------------------------------------------------------- - | Markdown Mail Settings - |-------------------------------------------------------------------------- - | - | If you are using Markdown based email rendering, you may configure your - | theme and component paths here, allowing you to customize the design - | of the emails. Or, you may simply stick with the Laravel defaults! - | - */ - 'markdown' => [ 'theme' => 'default', diff --git a/config/queue.php b/config/queue.php index e8b43ce6..ce51e128 100644 --- a/config/queue.php +++ b/config/queue.php @@ -2,66 +2,7 @@ return [ - /* - |-------------------------------------------------------------------------- - | Default Queue Connection Name - |-------------------------------------------------------------------------- - | - | Laravel's queue API supports an assortment of back-ends via a single - | API, giving you convenient access to each back-end using the same - | syntax for every one. Here you may define a default connection. - | - */ - - 'default' => env('QUEUE_CONNECTION', 'sync'), - - /* - |-------------------------------------------------------------------------- - | Queue Connections - |-------------------------------------------------------------------------- - | - | Here you may configure the connection information for each server that - | is used by your application. A default configuration has been added - | for each back-end shipped with Laravel. You are free to add more. - | - | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" - | - */ - 'connections' => [ - - 'sync' => [ - 'driver' => 'sync', - ], - - 'database' => [ - 'driver' => 'database', - 'table' => 'jobs', - 'queue' => 'default', - 'retry_after' => 60, - 'after_commit' => false, - ], - - 'beanstalkd' => [ - 'driver' => 'beanstalkd', - 'host' => 'localhost', - 'queue' => 'default', - 'retry_after' => 60, - 'block_for' => 0, - 'after_commit' => false, - ], - - 'sqs' => [ - 'driver' => 'sqs', - 'key' => env('AWS_ACCESS_KEY_ID'), - 'secret' => env('AWS_SECRET_ACCESS_KEY'), - 'prefix' => env('SQS_PREFIX', 'https://sqs.us-east-1.amazonaws.com/your-account-id'), - 'queue' => env('SQS_QUEUE', 'default'), - 'suffix' => env('SQS_SUFFIX'), - 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), - 'after_commit' => false, - ], - 'iron' => [ 'driver' => 'iron', 'host' => 'mq-aws-us-east-1.iron.io', @@ -70,33 +11,6 @@ 'queue' => 'your-queue-name', 'encrypt' => true, ], - - 'redis' => [ - 'driver' => 'redis', - 'connection' => 'default', - 'queue' => env('REDIS_QUEUE', 'default'), - 'retry_after' => 60, - 'block_for' => null, - 'after_commit' => false, - ], - - ], - - /* - |-------------------------------------------------------------------------- - | Failed Queue Jobs - |-------------------------------------------------------------------------- - | - | These options configure the behavior of failed queue job logging so you - | can control which database and table are used to store the jobs that - | have failed. You may change them to any database / table you wish. - | - */ - - 'failed' => [ - 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), - 'database' => env('DB_CONNECTION', 'mysql'), - 'table' => 'failed_jobs', ], ]; diff --git a/config/services.php b/config/services.php index 7eac7155..2f536bed 100644 --- a/config/services.php +++ b/config/services.php @@ -2,18 +2,6 @@ return [ - /* - |-------------------------------------------------------------------------- - | Third Party Services - |-------------------------------------------------------------------------- - | - | This file is for storing the credentials for third party services such - | as Mailgun, Postmark, AWS and more. This file provides the de facto - | location for this type of information, allowing packages to have - | a conventional file to locate the various service credentials. - | - */ - 'mailgun' => [ 'domain' => env('MAILGUN_DOMAIN'), 'secret' => env('MAILGUN_SECRET'), @@ -25,16 +13,6 @@ 'secret' => '', ], - 'postmark' => [ - 'token' => env('POSTMARK_TOKEN'), - ], - - 'ses' => [ - 'key' => env('AWS_ACCESS_KEY_ID'), - 'secret' => env('AWS_SECRET_ACCESS_KEY'), - 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), - ], - 'stripe' => [ 'model' => Jitterbug\Models\User::class, 'secret' => '', diff --git a/config/session.php b/config/session.php index 33fb6658..9f006821 100644 --- a/config/session.php +++ b/config/session.php @@ -1,201 +1,7 @@ env('SESSION_DRIVER', 'file'), - - /* - |-------------------------------------------------------------------------- - | Session Lifetime - |-------------------------------------------------------------------------- - | - | Here you may specify the number of minutes that you wish the session - | to be allowed to remain idle before it expires. If you want them - | to immediately expire on the browser closing, set that option. - | - */ - - 'lifetime' => env('SESSION_LIFETIME', 120), - - 'expire_on_close' => false, - - /* - |-------------------------------------------------------------------------- - | Session Encryption - |-------------------------------------------------------------------------- - | - | This option allows you to easily specify that all of your session data - | should be encrypted before it is stored. All encryption will be run - | automatically by Laravel and you can use the Session like normal. - | - */ - - 'encrypt' => false, - - /* - |-------------------------------------------------------------------------- - | Session File Location - |-------------------------------------------------------------------------- - | - | When using the native session driver, we need a location where session - | files may be stored. A default has been set for you but a different - | location may be specified. This is only needed for file sessions. - | - */ - 'files' => env('STORAGE_PATH', storage_path()).'/framework/sessions', - /* - |-------------------------------------------------------------------------- - | Session Database Connection - |-------------------------------------------------------------------------- - | - | When using the "database" or "redis" session drivers, you may specify a - | connection that should be used to manage these sessions. This should - | correspond to a connection in your database configuration options. - | - */ - - 'connection' => env('SESSION_CONNECTION'), - - /* - |-------------------------------------------------------------------------- - | Session Database Table - |-------------------------------------------------------------------------- - | - | When using the "database" session driver, you may specify the table we - | should use to manage the sessions. Of course, a sensible default is - | provided for you; however, you are free to change this as needed. - | - */ - - 'table' => 'sessions', - - /* - |-------------------------------------------------------------------------- - | Session Cache Store - |-------------------------------------------------------------------------- - | - | While using one of the framework's cache driven session backends you may - | list a cache store that should be used for these sessions. This value - | must match with one of the application's configured cache "stores". - | - | Affects: "apc", "dynamodb", "memcached", "redis" - | - */ - - 'store' => env('SESSION_STORE'), - - /* - |-------------------------------------------------------------------------- - | Session Sweeping Lottery - |-------------------------------------------------------------------------- - | - | Some session drivers must manually sweep their storage location to get - | rid of old sessions from storage. Here are the chances that it will - | happen on a given request. By default, the odds are 2 out of 100. - | - */ - - 'lottery' => [2, 100], - - /* - |-------------------------------------------------------------------------- - | Session Cookie Name - |-------------------------------------------------------------------------- - | - | Here you may change the name of the cookie used to identify a session - | instance by ID. The name specified here will get used every time a - | new session cookie is created by the framework for every driver. - | - */ - - 'cookie' => env( - 'SESSION_COOKIE', - Str::slug(env('APP_NAME', 'laravel'), '_').'_session' - ), - - /* - |-------------------------------------------------------------------------- - | Session Cookie Path - |-------------------------------------------------------------------------- - | - | The session cookie path determines the path for which the cookie will - | be regarded as available. Typically, this will be the root path of - | your application but you are free to change this when necessary. - | - */ - - 'path' => '/', - - /* - |-------------------------------------------------------------------------- - | Session Cookie Domain - |-------------------------------------------------------------------------- - | - | Here you may change the domain of the cookie used to identify a session - | in your application. This will determine which domains the cookie is - | available to in your application. A sensible default has been set. - | - */ - - 'domain' => env('SESSION_DOMAIN'), - - /* - |-------------------------------------------------------------------------- - | HTTPS Only Cookies - |-------------------------------------------------------------------------- - | - | By setting this option to true, session cookies will only be sent back - | to the server if the browser has a HTTPS connection. This will keep - | the cookie from being sent to you when it can't be done securely. - | - */ - - 'secure' => env('SESSION_SECURE_COOKIE'), - - /* - |-------------------------------------------------------------------------- - | HTTP Access Only - |-------------------------------------------------------------------------- - | - | Setting this value to true will prevent JavaScript from accessing the - | value of the cookie and the cookie will only be accessible through - | the HTTP protocol. You are free to modify this option if needed. - | - */ - - 'http_only' => true, - - /* - |-------------------------------------------------------------------------- - | Same-Site Cookies - |-------------------------------------------------------------------------- - | - | This option determines how your cookies behave when cross-site requests - | take place, and can be used to mitigate CSRF attacks. By default, we - | will set this value to "lax" since this is a secure default value. - | - | Supported: "lax", "strict", "none", null - | - */ - - 'same_site' => 'lax', - ]; diff --git a/config/view.php b/config/view.php index d384ec67..535a5745 100644 --- a/config/view.php +++ b/config/view.php @@ -2,32 +2,8 @@ return [ - /* - |-------------------------------------------------------------------------- - | View Storage Paths - |-------------------------------------------------------------------------- - | - | Most templating systems load templates from disk. Here you may specify - | an array of paths that should be checked for your views. Of course - | the usual Laravel view path has already been registered for you. - | - */ - 'paths' => [ realpath(base_path('resources/views')), ], - /* - |-------------------------------------------------------------------------- - | Compiled View Path - |-------------------------------------------------------------------------- - | - | This option determines where all the compiled Blade templates will be - | stored for your application. Typically, this is within the storage - | directory. However, as usual, you are free to change this value. - | - */ - - 'compiled' => env('STORAGE_PATH', realpath(storage_path())).'/framework/views', - ]; diff --git a/database/factories/AudioItemFactory.php b/database/factories/AudioItemFactory.php index 8ae13b81..d061be51 100644 --- a/database/factories/AudioItemFactory.php +++ b/database/factories/AudioItemFactory.php @@ -16,10 +16,8 @@ class AudioItemFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'call_number' => 'FS-'.$this->faker->randomNumber(4), diff --git a/database/factories/AudioTransferFactory.php b/database/factories/AudioTransferFactory.php index 04df4a21..3e654467 100644 --- a/database/factories/AudioTransferFactory.php +++ b/database/factories/AudioTransferFactory.php @@ -16,10 +16,8 @@ class AudioTransferFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'stylus' => $this->faker->word(), diff --git a/database/factories/AudioVisualItemFactory.php b/database/factories/AudioVisualItemFactory.php index 533a89f6..24018650 100644 --- a/database/factories/AudioVisualItemFactory.php +++ b/database/factories/AudioVisualItemFactory.php @@ -19,10 +19,8 @@ class AudioVisualItemFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'call_number' => 'FS-'.$this->faker->randomNumber(4), diff --git a/database/factories/CollectionFactory.php b/database/factories/CollectionFactory.php index c96bbde9..fe0ca1b3 100644 --- a/database/factories/CollectionFactory.php +++ b/database/factories/CollectionFactory.php @@ -17,10 +17,8 @@ class CollectionFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'name' => $this->faker->name(), diff --git a/database/factories/CollectionTypeFactory.php b/database/factories/CollectionTypeFactory.php index cbc82eaf..eea51b69 100644 --- a/database/factories/CollectionTypeFactory.php +++ b/database/factories/CollectionTypeFactory.php @@ -16,10 +16,8 @@ class CollectionTypeFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'name' => $this->faker->word(), diff --git a/database/factories/CutFactory.php b/database/factories/CutFactory.php index 95e85511..faa046fa 100644 --- a/database/factories/CutFactory.php +++ b/database/factories/CutFactory.php @@ -17,8 +17,6 @@ class CutFactory extends Factory /** * Define the model's default state. - * - * @return array */ public function definition(): array { diff --git a/database/factories/DepartmentFactory.php b/database/factories/DepartmentFactory.php index 7273ad93..8b55ebc5 100644 --- a/database/factories/DepartmentFactory.php +++ b/database/factories/DepartmentFactory.php @@ -16,10 +16,8 @@ class DepartmentFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'name' => $this->faker->name(), diff --git a/database/factories/FormatFactory.php b/database/factories/FormatFactory.php index 95f1b185..47e157f3 100644 --- a/database/factories/FormatFactory.php +++ b/database/factories/FormatFactory.php @@ -16,10 +16,8 @@ class FormatFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'name' => $this->faker->word(), diff --git a/database/factories/ImportTransactionFactory.php b/database/factories/ImportTransactionFactory.php index 424cec3f..ebcc69fd 100644 --- a/database/factories/ImportTransactionFactory.php +++ b/database/factories/ImportTransactionFactory.php @@ -16,10 +16,8 @@ class ImportTransactionFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'transaction_id' => $this->faker->word(), diff --git a/database/factories/LegacyCallNumberSequenceFactory.php b/database/factories/LegacyCallNumberSequenceFactory.php index cd60c0dd..261225af 100644 --- a/database/factories/LegacyCallNumberSequenceFactory.php +++ b/database/factories/LegacyCallNumberSequenceFactory.php @@ -16,10 +16,8 @@ class LegacyCallNumberSequenceFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'prefix' => $this->faker->word(), diff --git a/database/factories/MarkFactory.php b/database/factories/MarkFactory.php index 9af59d67..caa79b62 100644 --- a/database/factories/MarkFactory.php +++ b/database/factories/MarkFactory.php @@ -16,10 +16,8 @@ class MarkFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'user_id' => $this->faker->randomNumber(), diff --git a/database/factories/NewCallNumberSequenceFactory.php b/database/factories/NewCallNumberSequenceFactory.php index 3d008d74..59cd9416 100644 --- a/database/factories/NewCallNumberSequenceFactory.php +++ b/database/factories/NewCallNumberSequenceFactory.php @@ -17,10 +17,8 @@ class NewCallNumberSequenceFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'prefix' => strtoupper($this->faker->lexify('??')), diff --git a/database/factories/PlaybackMachineFactory.php b/database/factories/PlaybackMachineFactory.php index 2a49f1e9..78211031 100644 --- a/database/factories/PlaybackMachineFactory.php +++ b/database/factories/PlaybackMachineFactory.php @@ -16,10 +16,8 @@ class PlaybackMachineFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'name' => $this->faker->name(), diff --git a/database/factories/PrefixFactory.php b/database/factories/PrefixFactory.php index 8e843b20..3cac9996 100644 --- a/database/factories/PrefixFactory.php +++ b/database/factories/PrefixFactory.php @@ -16,10 +16,8 @@ class PrefixFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'label' => strtoupper($this->faker->lexify('??')), diff --git a/database/factories/PreservationInstanceFactory.php b/database/factories/PreservationInstanceFactory.php index b175452e..fdc5bd13 100644 --- a/database/factories/PreservationInstanceFactory.php +++ b/database/factories/PreservationInstanceFactory.php @@ -19,10 +19,8 @@ class PreservationInstanceFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'call_number' => 'FS-'.$this->faker->randomNumber(4), diff --git a/database/factories/ProjectFactory.php b/database/factories/ProjectFactory.php index cd865d93..9c5a3470 100644 --- a/database/factories/ProjectFactory.php +++ b/database/factories/ProjectFactory.php @@ -16,10 +16,8 @@ class ProjectFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'name' => $this->faker->name(), diff --git a/database/factories/ReproductionMachineFactory.php b/database/factories/ReproductionMachineFactory.php index a98c02cb..66f69771 100644 --- a/database/factories/ReproductionMachineFactory.php +++ b/database/factories/ReproductionMachineFactory.php @@ -16,10 +16,8 @@ class ReproductionMachineFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'name' => $this->faker->name(), diff --git a/database/factories/TransferFactory.php b/database/factories/TransferFactory.php index 2351c83e..3c807a6e 100644 --- a/database/factories/TransferFactory.php +++ b/database/factories/TransferFactory.php @@ -20,10 +20,8 @@ class TransferFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'preservation_instance_id' => PreservationInstance::factory(), diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index a579751b..835cf3ea 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -16,10 +16,8 @@ class UserFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'first_name' => $this->faker->firstName(), diff --git a/database/factories/VendorFactory.php b/database/factories/VendorFactory.php index 6f76bc7e..fa609413 100644 --- a/database/factories/VendorFactory.php +++ b/database/factories/VendorFactory.php @@ -16,10 +16,8 @@ class VendorFactory extends Factory /** * Define the model's default state. - * - * @return array */ - public function definition() + public function definition(): array { return [ 'name' => $this->faker->name(), diff --git a/database/migrations/2016_08_04_150723_create_initial_tables.php b/database/migrations/2016_08_04_150723_create_initial_tables.php index 06041f20..b8458f66 100644 --- a/database/migrations/2016_08_04_150723_create_initial_tables.php +++ b/database/migrations/2016_08_04_150723_create_initial_tables.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('revisions', function (Blueprint $table) { $table->bigIncrements('id'); @@ -128,10 +126,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('revisions'); Schema::drop('audio_visual_items'); diff --git a/database/migrations/2016_08_04_164807_create_transfer_tables.php b/database/migrations/2016_08_04_164807_create_transfer_tables.php index 16aad26b..fe1c3cf9 100644 --- a/database/migrations/2016_08_04_164807_create_transfer_tables.php +++ b/database/migrations/2016_08_04_164807_create_transfer_tables.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('playback_machines', function (Blueprint $table) { $table->smallIncrements('id'); @@ -66,10 +64,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('playback_machines'); Schema::drop('cuts'); diff --git a/database/migrations/2016_08_04_181904_create_user_and_masters_tables.php b/database/migrations/2016_08_04_181904_create_user_and_masters_tables.php index e3d4b3de..8e7ffcb6 100644 --- a/database/migrations/2016_08_04_181904_create_user_and_masters_tables.php +++ b/database/migrations/2016_08_04_181904_create_user_and_masters_tables.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('preservation_masters', function (Blueprint $table) { $table->increments('id'); @@ -105,10 +103,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('preservation_masters'); Schema::drop('audio_masters'); diff --git a/database/migrations/2016_08_04_184929_create_call_number_sequence_tables.php b/database/migrations/2016_08_04_184929_create_call_number_sequence_tables.php index 4f4ede8c..1b7c5846 100644 --- a/database/migrations/2016_08_04_184929_create_call_number_sequence_tables.php +++ b/database/migrations/2016_08_04_184929_create_call_number_sequence_tables.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('new_call_number_sequences', function (Blueprint $table) { $table->increments('id'); @@ -35,10 +33,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('new_call_number_sequences'); Schema::drop('legacy_call_number_sequences'); diff --git a/database/migrations/2016_08_04_191358_create_initial_views.php b/database/migrations/2016_08_04_191358_create_initial_views.php index 25dffd2e..f341a56b 100644 --- a/database/migrations/2016_08_04_191358_create_initial_views.php +++ b/database/migrations/2016_08_04_191358_create_initial_views.php @@ -6,10 +6,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { DB::statement(' CREATE OR REPLACE VIEW audio_visual_item_collections AS @@ -190,10 +188,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { DB::statement('DROP VIEW IF EXISTS audio_visual_item_collections'); DB::statement('DROP VIEW IF EXISTS audio_visual_item_formats'); diff --git a/database/migrations/2016_08_16_175625_create_video_masters_table.php b/database/migrations/2016_08_16_175625_create_video_masters_table.php index 2c90a62d..49853173 100644 --- a/database/migrations/2016_08_16_175625_create_video_masters_table.php +++ b/database/migrations/2016_08_16_175625_create_video_masters_table.php @@ -7,10 +7,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('video_masters', function (Blueprint $table) { $table->increments('id'); @@ -24,10 +22,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('video_masters'); } diff --git a/database/migrations/2016_08_16_182510_create_film_masters_table.php b/database/migrations/2016_08_16_182510_create_film_masters_table.php index 657e15ae..20a667fb 100644 --- a/database/migrations/2016_08_16_182510_create_film_masters_table.php +++ b/database/migrations/2016_08_16_182510_create_film_masters_table.php @@ -7,10 +7,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('film_masters', function (Blueprint $table) { $table->increments('id'); @@ -24,10 +22,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('film_masters'); } diff --git a/database/migrations/2016_08_19_150248_create_vendors_table.php b/database/migrations/2016_08_19_150248_create_vendors_table.php index 1a00e579..5952709c 100644 --- a/database/migrations/2016_08_19_150248_create_vendors_table.php +++ b/database/migrations/2016_08_19_150248_create_vendors_table.php @@ -7,10 +7,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('vendors', function (Blueprint $table) { $table->increments('id'); @@ -29,10 +27,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('vendors'); } diff --git a/database/migrations/2016_10_15_160609_create_video_transfers_table.php b/database/migrations/2016_10_15_160609_create_video_transfers_table.php index b22ea965..a2c0c5b0 100644 --- a/database/migrations/2016_10_15_160609_create_video_transfers_table.php +++ b/database/migrations/2016_10_15_160609_create_video_transfers_table.php @@ -7,10 +7,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('video_transfers', function (Blueprint $table) { $table->increments('id'); @@ -24,10 +22,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('video_transfers'); } diff --git a/database/migrations/2016_10_15_160948_create_film_transfers_table.php b/database/migrations/2016_10_15_160948_create_film_transfers_table.php index 2a9edb0e..54a17382 100644 --- a/database/migrations/2016_10_15_160948_create_film_transfers_table.php +++ b/database/migrations/2016_10_15_160948_create_film_transfers_table.php @@ -7,10 +7,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('film_transfers', function (Blueprint $table) { $table->increments('id'); @@ -22,10 +20,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('film_transfers'); } diff --git a/database/migrations/2016_11_14_200602_add_accession_number_to_audio_visual_items_table.php b/database/migrations/2016_11_14_200602_add_accession_number_to_audio_visual_items_table.php index 1364edcf..d6f2f07a 100644 --- a/database/migrations/2016_11_14_200602_add_accession_number_to_audio_visual_items_table.php +++ b/database/migrations/2016_11_14_200602_add_accession_number_to_audio_visual_items_table.php @@ -7,10 +7,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('audio_visual_items', function (Blueprint $table) { $table->integer('accession_number')->nullable()->after('collection_id'); @@ -19,10 +17,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('audio_visual_items', function (Blueprint $table) { $table->dropColumn('accession_number'); diff --git a/database/migrations/2016_11_15_233915_create_marks_table.php b/database/migrations/2016_11_15_233915_create_marks_table.php index ddd35b96..05f04d7e 100644 --- a/database/migrations/2016_11_15_233915_create_marks_table.php +++ b/database/migrations/2016_11_15_233915_create_marks_table.php @@ -7,10 +7,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('marks', function (Blueprint $table) { $table->increments('id'); @@ -24,10 +22,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('marks'); } diff --git a/database/migrations/2017_01_05_155912_create_activities_table.php b/database/migrations/2017_01_05_155912_create_activities_table.php index 4eaade29..9a84ecac 100644 --- a/database/migrations/2017_01_05_155912_create_activities_table.php +++ b/database/migrations/2017_01_05_155912_create_activities_table.php @@ -7,10 +7,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('activities', function (Blueprint $table) { $table->increments('id'); @@ -33,10 +31,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('activities'); } diff --git a/database/migrations/2017_02_02_184602_add_deleted_at_to_collections_table.php b/database/migrations/2017_02_02_184602_add_deleted_at_to_collections_table.php index ec8c534c..fba92259 100644 --- a/database/migrations/2017_02_02_184602_add_deleted_at_to_collections_table.php +++ b/database/migrations/2017_02_02_184602_add_deleted_at_to_collections_table.php @@ -7,10 +7,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('collections', function (Blueprint $table) { $table->timestamp('deleted_at')->nullable()->after('created_at'); @@ -19,10 +17,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('collections', function (Blueprint $table) { $table->dropColumn('deleted_at'); diff --git a/database/migrations/2017_02_03_160348_add_deleted_at_to_formats_table.php b/database/migrations/2017_02_03_160348_add_deleted_at_to_formats_table.php index 58be1eef..245e0e0e 100644 --- a/database/migrations/2017_02_03_160348_add_deleted_at_to_formats_table.php +++ b/database/migrations/2017_02_03_160348_add_deleted_at_to_formats_table.php @@ -7,10 +7,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('formats', function (Blueprint $table) { $table->timestamp('deleted_at')->nullable()->after('created_at'); @@ -19,10 +17,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('formats', function (Blueprint $table) { $table->dropColumn('deleted_at'); diff --git a/database/migrations/2017_02_03_162412_add_deleted_at_to_projects_table.php b/database/migrations/2017_02_03_162412_add_deleted_at_to_projects_table.php index 52637bb3..516c013f 100644 --- a/database/migrations/2017_02_03_162412_add_deleted_at_to_projects_table.php +++ b/database/migrations/2017_02_03_162412_add_deleted_at_to_projects_table.php @@ -7,10 +7,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('projects', function (Blueprint $table) { $table->timestamp('deleted_at')->nullable()->after('created_at'); @@ -19,10 +17,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('projects', function (Blueprint $table) { $table->dropColumn('deleted_at'); diff --git a/database/migrations/2017_02_03_162426_add_deleted_at_to_vendors_table.php b/database/migrations/2017_02_03_162426_add_deleted_at_to_vendors_table.php index 2a6410b7..951baf35 100644 --- a/database/migrations/2017_02_03_162426_add_deleted_at_to_vendors_table.php +++ b/database/migrations/2017_02_03_162426_add_deleted_at_to_vendors_table.php @@ -7,10 +7,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('vendors', function (Blueprint $table) { $table->timestamp('deleted_at')->nullable()->after('created_at'); @@ -19,10 +17,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('vendors', function (Blueprint $table) { $table->dropColumn('deleted_at'); diff --git a/database/migrations/2017_02_03_162445_add_deleted_at_to_departments_table.php b/database/migrations/2017_02_03_162445_add_deleted_at_to_departments_table.php index f8a741e1..cef16633 100644 --- a/database/migrations/2017_02_03_162445_add_deleted_at_to_departments_table.php +++ b/database/migrations/2017_02_03_162445_add_deleted_at_to_departments_table.php @@ -7,10 +7,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('departments', function (Blueprint $table) { $table->timestamp('deleted_at')->nullable()->after('created_at'); @@ -19,10 +17,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('departments', function (Blueprint $table) { $table->dropColumn('deleted_at'); diff --git a/database/migrations/2017_02_03_162509_add_deleted_at_to_playback_machines_table.php b/database/migrations/2017_02_03_162509_add_deleted_at_to_playback_machines_table.php index c2466dee..aa925e52 100644 --- a/database/migrations/2017_02_03_162509_add_deleted_at_to_playback_machines_table.php +++ b/database/migrations/2017_02_03_162509_add_deleted_at_to_playback_machines_table.php @@ -7,10 +7,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('playback_machines', function (Blueprint $table) { $table->timestamp('deleted_at')->nullable()->after('created_at'); @@ -19,10 +17,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('playback_machines', function (Blueprint $table) { $table->dropColumn('deleted_at'); diff --git a/database/migrations/2017_02_03_162551_add_deleted_at_to_reproduction_machines_table.php b/database/migrations/2017_02_03_162551_add_deleted_at_to_reproduction_machines_table.php index b474092b..37f7e39f 100644 --- a/database/migrations/2017_02_03_162551_add_deleted_at_to_reproduction_machines_table.php +++ b/database/migrations/2017_02_03_162551_add_deleted_at_to_reproduction_machines_table.php @@ -7,10 +7,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('reproduction_machines', function (Blueprint $table) { $table->timestamp('deleted_at')->nullable()->after('created_at'); @@ -19,10 +17,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('reproduction_machines', function (Blueprint $table) { $table->dropColumn('deleted_at'); diff --git a/database/migrations/2017_02_03_162614_add_deleted_at_to_sampling_rates_table.php b/database/migrations/2017_02_03_162614_add_deleted_at_to_sampling_rates_table.php index 1cd232c4..24d6e6a9 100644 --- a/database/migrations/2017_02_03_162614_add_deleted_at_to_sampling_rates_table.php +++ b/database/migrations/2017_02_03_162614_add_deleted_at_to_sampling_rates_table.php @@ -7,10 +7,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('sampling_rates', function (Blueprint $table) { $table->timestamp('deleted_at')->nullable()->after('created_at'); @@ -19,10 +17,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('sampling_rates', function (Blueprint $table) { $table->dropColumn('deleted_at'); diff --git a/database/migrations/2017_02_03_162638_add_deleted_at_to_pm_speeds_table.php b/database/migrations/2017_02_03_162638_add_deleted_at_to_pm_speeds_table.php index 2c1c524b..940a57ec 100644 --- a/database/migrations/2017_02_03_162638_add_deleted_at_to_pm_speeds_table.php +++ b/database/migrations/2017_02_03_162638_add_deleted_at_to_pm_speeds_table.php @@ -7,10 +7,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('pm_speeds', function (Blueprint $table) { $table->timestamp('deleted_at')->nullable()->after('created_at'); @@ -19,10 +17,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('pm_speeds', function (Blueprint $table) { $table->dropColumn('deleted_at'); diff --git a/database/migrations/2017_02_03_162658_add_deleted_at_to_tape_brands_table.php b/database/migrations/2017_02_03_162658_add_deleted_at_to_tape_brands_table.php index 674d9c69..27a7846f 100644 --- a/database/migrations/2017_02_03_162658_add_deleted_at_to_tape_brands_table.php +++ b/database/migrations/2017_02_03_162658_add_deleted_at_to_tape_brands_table.php @@ -7,10 +7,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('tape_brands', function (Blueprint $table) { $table->timestamp('deleted_at')->nullable()->after('created_at'); @@ -19,10 +17,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('tape_brands', function (Blueprint $table) { $table->dropColumn('deleted_at'); diff --git a/database/migrations/2017_02_10_014336_convert_call_number_index_on_audio_visual_items_table.php b/database/migrations/2017_02_10_014336_convert_call_number_index_on_audio_visual_items_table.php index d8c8efd5..1ae61e79 100644 --- a/database/migrations/2017_02_10_014336_convert_call_number_index_on_audio_visual_items_table.php +++ b/database/migrations/2017_02_10_014336_convert_call_number_index_on_audio_visual_items_table.php @@ -7,10 +7,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('audio_visual_items', function (Blueprint $table) { $table->dropUnique('call_number'); @@ -20,10 +18,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('audio_visual_items', function (Blueprint $table) { $table->dropIndex('call_number'); diff --git a/database/migrations/2017_02_10_020129_convert_call_number_index_on_audio_items_table.php b/database/migrations/2017_02_10_020129_convert_call_number_index_on_audio_items_table.php index 14b18956..bc87838f 100644 --- a/database/migrations/2017_02_10_020129_convert_call_number_index_on_audio_items_table.php +++ b/database/migrations/2017_02_10_020129_convert_call_number_index_on_audio_items_table.php @@ -7,10 +7,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('audio_items', function (Blueprint $table) { $table->dropUnique('call_number'); @@ -20,10 +18,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('audio_items', function (Blueprint $table) { $table->dropIndex('call_number'); diff --git a/database/migrations/2017_02_10_020249_convert_call_number_index_on_film_items_table.php b/database/migrations/2017_02_10_020249_convert_call_number_index_on_film_items_table.php index 8ddbb111..a6f8235e 100644 --- a/database/migrations/2017_02_10_020249_convert_call_number_index_on_film_items_table.php +++ b/database/migrations/2017_02_10_020249_convert_call_number_index_on_film_items_table.php @@ -7,10 +7,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('film_items', function (Blueprint $table) { $table->dropUnique('call_number'); @@ -20,10 +18,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('film_items', function (Blueprint $table) { $table->dropIndex('call_number'); diff --git a/database/migrations/2017_02_10_020329_convert_call_number_index_on_video_items_table.php b/database/migrations/2017_02_10_020329_convert_call_number_index_on_video_items_table.php index 283c7233..3fae392a 100644 --- a/database/migrations/2017_02_10_020329_convert_call_number_index_on_video_items_table.php +++ b/database/migrations/2017_02_10_020329_convert_call_number_index_on_video_items_table.php @@ -7,10 +7,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('video_items', function (Blueprint $table) { $table->dropUnique('call_number'); @@ -20,10 +18,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('video_items', function (Blueprint $table) { $table->dropIndex('call_number'); diff --git a/database/migrations/2017_02_10_020540_convert_call_number_index_on_formats_table.php b/database/migrations/2017_02_10_020540_convert_call_number_index_on_formats_table.php index a8ca446d..a885dc79 100644 --- a/database/migrations/2017_02_10_020540_convert_call_number_index_on_formats_table.php +++ b/database/migrations/2017_02_10_020540_convert_call_number_index_on_formats_table.php @@ -7,10 +7,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('formats', function (Blueprint $table) { $table->dropUnique('name'); @@ -20,10 +18,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('formats', function (Blueprint $table) { $table->dropIndex('name'); diff --git a/database/migrations/2017_02_10_020642_convert_call_number_index_on_collections_table.php b/database/migrations/2017_02_10_020642_convert_call_number_index_on_collections_table.php index 5f211160..e0264595 100644 --- a/database/migrations/2017_02_10_020642_convert_call_number_index_on_collections_table.php +++ b/database/migrations/2017_02_10_020642_convert_call_number_index_on_collections_table.php @@ -7,10 +7,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('collections', function (Blueprint $table) { $table->dropUnique('name'); @@ -20,10 +18,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('collections', function (Blueprint $table) { $table->dropIndex('name'); diff --git a/database/migrations/2017_02_15_162024_add_legacy_to_audio_visual_items_table.php b/database/migrations/2017_02_15_162024_add_legacy_to_audio_visual_items_table.php index ffa4d1a4..c5ab7e81 100644 --- a/database/migrations/2017_02_15_162024_add_legacy_to_audio_visual_items_table.php +++ b/database/migrations/2017_02_15_162024_add_legacy_to_audio_visual_items_table.php @@ -7,10 +7,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('audio_visual_items', function (Blueprint $table) { $table->string('legacy')->nullable()->after('accession_number'); @@ -19,10 +17,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('audio_visual_items', function (Blueprint $table) { $table->dropColumn('legacy'); diff --git a/database/migrations/2017_02_16_200243_create_import_transactions_table.php b/database/migrations/2017_02_16_200243_create_import_transactions_table.php index e14682c3..843cdabc 100644 --- a/database/migrations/2017_02_16_200243_create_import_transactions_table.php +++ b/database/migrations/2017_02_16_200243_create_import_transactions_table.php @@ -7,10 +7,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('import_transactions', function (Blueprint $table) { $table->increments('id'); @@ -22,10 +20,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::drop('import_transactions'); } diff --git a/database/migrations/2017_07_30_144025_add_condition_to_film_items_table.php b/database/migrations/2017_07_30_144025_add_condition_to_film_items_table.php index 2d7b2c7c..f4323599 100644 --- a/database/migrations/2017_07_30_144025_add_condition_to_film_items_table.php +++ b/database/migrations/2017_07_30_144025_add_condition_to_film_items_table.php @@ -7,10 +7,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('film_items', function (Blueprint $table) { $table->string('condition')->nullable()->after('shrinkage_percent'); @@ -19,10 +17,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('film_items', function (Blueprint $table) { $table->dropColumn('condition'); diff --git a/database/migrations/2017_08_26_154232_add_access_restrictions_to_audio_visual_items_table.php b/database/migrations/2017_08_26_154232_add_access_restrictions_to_audio_visual_items_table.php index 663f5a33..0e117435 100644 --- a/database/migrations/2017_08_26_154232_add_access_restrictions_to_audio_visual_items_table.php +++ b/database/migrations/2017_08_26_154232_add_access_restrictions_to_audio_visual_items_table.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('audio_visual_items', function (Blueprint $table) { $table->string('access_restrictions')->nullable()->after('recording_location'); @@ -20,10 +18,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('audio_visual_items', function (Blueprint $table) { $table->dropColumn('access_restrictions'); diff --git a/database/migrations/2017_09_09_192949_add_physical_location_to_audio_visual_items_table.php b/database/migrations/2017_09_09_192949_add_physical_location_to_audio_visual_items_table.php index 129e8408..654a6a03 100644 --- a/database/migrations/2017_09_09_192949_add_physical_location_to_audio_visual_items_table.php +++ b/database/migrations/2017_09_09_192949_add_physical_location_to_audio_visual_items_table.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('audio_visual_items', function (Blueprint $table) { $table->string('physical_location')->nullable()->after('recording_location'); @@ -20,10 +18,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('audio_visual_items', function (Blueprint $table) { $table->dropColumn('physical_location'); diff --git a/database/migrations/2017_10_22_195056_add_reel_tape_number_to_audio_visual_items_table.php b/database/migrations/2017_10_22_195056_add_reel_tape_number_to_audio_visual_items_table.php index e94f4e41..470464e9 100644 --- a/database/migrations/2017_10_22_195056_add_reel_tape_number_to_audio_visual_items_table.php +++ b/database/migrations/2017_10_22_195056_add_reel_tape_number_to_audio_visual_items_table.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('audio_visual_items', function (Blueprint $table) { $table->string('reel_tape_number')->nullable()->after('format_id'); @@ -20,10 +18,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('audio_visual_items', function (Blueprint $table) { $table->dropColumn('reel_tape_number'); diff --git a/database/migrations/2019_04_17_185410_create_prefixes_table.php b/database/migrations/2019_04_17_185410_create_prefixes_table.php index 4563ea4f..f255396f 100644 --- a/database/migrations/2019_04_17_185410_create_prefixes_table.php +++ b/database/migrations/2019_04_17_185410_create_prefixes_table.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('prefixes', function (Blueprint $table) { $table->increments('id'); @@ -25,10 +23,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('prefixes'); } diff --git a/database/migrations/2019_04_17_201645_create_collection_types_table.php b/database/migrations/2019_04_17_201645_create_collection_types_table.php index f1e4e594..f7179460 100644 --- a/database/migrations/2019_04_17_201645_create_collection_types_table.php +++ b/database/migrations/2019_04_17_201645_create_collection_types_table.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('collection_types', function (Blueprint $table) { $table->increments('id'); @@ -23,10 +21,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('collection_types'); } diff --git a/database/migrations/2019_04_17_203043_create_format_prefix_table.php b/database/migrations/2019_04_17_203043_create_format_prefix_table.php index 33d03cac..6def08b1 100644 --- a/database/migrations/2019_04_17_203043_create_format_prefix_table.php +++ b/database/migrations/2019_04_17_203043_create_format_prefix_table.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('format_prefix', function (Blueprint $table) { $table->smallInteger('format_id')->unsigned(); @@ -25,10 +23,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('format_prefix'); } diff --git a/database/migrations/2019_04_22_180550_add_collection_type_id_to_collections.php b/database/migrations/2019_04_22_180550_add_collection_type_id_to_collections.php index d1cf9ec7..5210a2bd 100644 --- a/database/migrations/2019_04_22_180550_add_collection_type_id_to_collections.php +++ b/database/migrations/2019_04_22_180550_add_collection_type_id_to_collections.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('collections', function (Blueprint $table) { $table->integer('collection_type_id')->nullable()->after('name'); @@ -20,10 +18,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('collections', function (Blueprint $table) { $table->dropColumn('collection_type_id'); diff --git a/database/migrations/2019_06_10_151250_add_archival_identifier_to_collections_table.php b/database/migrations/2019_06_10_151250_add_archival_identifier_to_collections_table.php index b7343658..494ae158 100644 --- a/database/migrations/2019_06_10_151250_add_archival_identifier_to_collections_table.php +++ b/database/migrations/2019_06_10_151250_add_archival_identifier_to_collections_table.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('collections', function (Blueprint $table) { $table->string('archival_identifier')->after('collection_type_id')->unique()->nullable(); @@ -20,10 +18,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('collections', function (Blueprint $table) { $table->dropColumn('archival_identifier'); diff --git a/database/migrations/2019_07_22_180603_add_archival_identifier_to_new_call_number_sequences.php b/database/migrations/2019_07_22_180603_add_archival_identifier_to_new_call_number_sequences.php index d710b1f9..45c7a601 100644 --- a/database/migrations/2019_07_22_180603_add_archival_identifier_to_new_call_number_sequences.php +++ b/database/migrations/2019_07_22_180603_add_archival_identifier_to_new_call_number_sequences.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('new_call_number_sequences', function (Blueprint $table) { $table->string('archival_identifier')->after('collection_id')->nullable(); @@ -20,10 +18,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('new_call_number_sequences', function (Blueprint $table) { $table->dropColumn('archival_identifier'); diff --git a/database/migrations/2019_08_23_194815_change_collection_id_column_to_autoincrement.php b/database/migrations/2019_08_23_194815_change_collection_id_column_to_autoincrement.php index d677bfac..0fe136f4 100644 --- a/database/migrations/2019_08_23_194815_change_collection_id_column_to_autoincrement.php +++ b/database/migrations/2019_08_23_194815_change_collection_id_column_to_autoincrement.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('collections', function (Blueprint $table) { $table->increments('id')->change(); @@ -20,10 +18,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('collections', function (Blueprint $table) { $table->integer('id')->change(); diff --git a/database/migrations/2020_01_24_203722_add_objectguid_column.php b/database/migrations/2020_01_24_203722_add_objectguid_column.php index 0108dfa7..6d43b453 100644 --- a/database/migrations/2020_01_24_203722_add_objectguid_column.php +++ b/database/migrations/2020_01_24_203722_add_objectguid_column.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('users', function (Blueprint $table) { $table->string('objectguid')->nullable()->after('id'); @@ -20,10 +18,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('users', function (Blueprint $table) { $table->dropColumn('objectguid'); diff --git a/database/migrations/2020_02_12_190752_change_accession_number_to_string.php b/database/migrations/2020_02_12_190752_change_accession_number_to_string.php index 06215f91..daf2ebd2 100644 --- a/database/migrations/2020_02_12_190752_change_accession_number_to_string.php +++ b/database/migrations/2020_02_12_190752_change_accession_number_to_string.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('audio_visual_items', function (Blueprint $table) { $table->string('accession_number', 255)->change(); @@ -20,10 +18,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('audio_visual_items', function (Blueprint $table) { $table->integer('accession_number')->change(); diff --git a/database/migrations/2020_05_20_191648_add_import_action_to_import_transactions_table.php b/database/migrations/2020_05_20_191648_add_import_action_to_import_transactions_table.php index 757ddecf..fcc913c7 100644 --- a/database/migrations/2020_05_20_191648_add_import_action_to_import_transactions_table.php +++ b/database/migrations/2020_05_20_191648_add_import_action_to_import_transactions_table.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('import_transactions', function (Blueprint $table) { $table->string('import_action', 255)->default('create')->after('import_type'); @@ -20,10 +18,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('import_transactions', function (Blueprint $table) { $table->dropColumn('import_action'); diff --git a/database/migrations/2020_07_08_183918_add_blank_to_audio_visual_items.php b/database/migrations/2020_07_08_183918_add_blank_to_audio_visual_items.php index dc036e2c..141f5ccc 100644 --- a/database/migrations/2020_07_08_183918_add_blank_to_audio_visual_items.php +++ b/database/migrations/2020_07_08_183918_add_blank_to_audio_visual_items.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('audio_visual_items', function (Blueprint $table) { $table->boolean('blank')->default(0)->after('subclass_id'); @@ -20,10 +18,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('audio_visual_items', function (Blueprint $table) { $table->dropColumn('blank'); diff --git a/database/migrations/2020_08_18_205555_add_inactive_to_users_table.php b/database/migrations/2020_08_18_205555_add_inactive_to_users_table.php index ca2ac796..e025e4ef 100644 --- a/database/migrations/2020_08_18_205555_add_inactive_to_users_table.php +++ b/database/migrations/2020_08_18_205555_add_inactive_to_users_table.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('users', function (Blueprint $table) { $table->boolean('inactive')->default(0)->after('legacy_initials'); @@ -20,10 +18,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('users', function (Blueprint $table) { $table->dropColumn('inactive'); diff --git a/database/migrations/2020_10_14_155824_delete_prefix_and_legacy_prefix_from_formats_table.php b/database/migrations/2020_10_14_155824_delete_prefix_and_legacy_prefix_from_formats_table.php index 00f29928..67dc1702 100644 --- a/database/migrations/2020_10_14_155824_delete_prefix_and_legacy_prefix_from_formats_table.php +++ b/database/migrations/2020_10_14_155824_delete_prefix_and_legacy_prefix_from_formats_table.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('formats', function (Blueprint $table) { $table->dropColumn(['prefix', 'legacy_prefix']); @@ -20,10 +18,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('formats', function (Blueprint $table) { $table->string('prefix', 255); diff --git a/database/migrations/2021_04_30_185446_change_preservation_master_table_to_preservation_instance.php b/database/migrations/2021_04_30_185446_change_preservation_master_table_to_preservation_instance.php index b055ae83..e8c30737 100644 --- a/database/migrations/2021_04_30_185446_change_preservation_master_table_to_preservation_instance.php +++ b/database/migrations/2021_04_30_185446_change_preservation_master_table_to_preservation_instance.php @@ -8,10 +8,8 @@ { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::rename('preservation_masters', 'preservation_instances'); Schema::rename('audio_masters', 'audio_instances'); @@ -107,10 +105,8 @@ public function up() /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::rename('preservation_instances', 'preservation_masters'); Schema::rename('audio_instances', 'audio_masters'); diff --git a/database/seeders/AddArchivalIdentifierToCallNumbersSeeder.php b/database/seeders/AddArchivalIdentifierToCallNumbersSeeder.php index c386dfab..aaeee7f9 100644 --- a/database/seeders/AddArchivalIdentifierToCallNumbersSeeder.php +++ b/database/seeders/AddArchivalIdentifierToCallNumbersSeeder.php @@ -8,18 +8,16 @@ class AddArchivalIdentifierToCallNumbersSeeder extends Seeder { /** * Run the database seeds. - * - * @return void */ - public function run() + public function run(): void { // find all the new call number sequences that need their archival_identifier field populated // fill it in with the corresponding archival identifier from the associated collection DB::table('new_call_number_sequences as sequence') - ->whereNull('sequence.archival_identifier') - ->join('collections as collection', 'sequence.collection_id', '=', 'collection.id') - ->update([ - 'sequence.archival_identifier' => DB::raw('`collection`.`archival_identifier`'), - ]); + ->whereNull('sequence.archival_identifier') + ->join('collections as collection', 'sequence.collection_id', '=', 'collection.id') + ->update([ + 'sequence.archival_identifier' => DB::raw('`collection`.`archival_identifier`'), + ]); } } diff --git a/database/seeders/AddArchivalIdentifierToCollectionsSeeder.php b/database/seeders/AddArchivalIdentifierToCollectionsSeeder.php index b186aaf6..d599a16a 100644 --- a/database/seeders/AddArchivalIdentifierToCollectionsSeeder.php +++ b/database/seeders/AddArchivalIdentifierToCollectionsSeeder.php @@ -8,17 +8,15 @@ class AddArchivalIdentifierToCollectionsSeeder extends Seeder { /** * Run the database seeds. - * - * @return void */ - public function run() + public function run(): void { // to backfill the collection IDs as strings in the archival_identifier column // TODO APPDEV-8779 delete seeder when collection ID is auto incrementing DB::table('collections')->whereNull('archival_identifier') - ->whereNull('deleted_at') - ->update([ - 'archival_identifier' => DB::raw('`id`'), - ]); + ->whereNull('deleted_at') + ->update([ + 'archival_identifier' => DB::raw('`id`'), + ]); } } diff --git a/database/seeders/AddCollectionTypeIdSeeder.php b/database/seeders/AddCollectionTypeIdSeeder.php index 3ecf12ad..e3905ad6 100644 --- a/database/seeders/AddCollectionTypeIdSeeder.php +++ b/database/seeders/AddCollectionTypeIdSeeder.php @@ -9,10 +9,8 @@ class AddCollectionTypeIdSeeder extends Seeder { /** * Run the database seeds. - * - * @return void */ - public function run() + public function run(): void { $uarmsId = 3; $shcId = 4; diff --git a/database/seeders/AdditionalFormatPrefixTableSeeder.php b/database/seeders/AdditionalFormatPrefixTableSeeder.php index eb14e00f..e239c266 100644 --- a/database/seeders/AdditionalFormatPrefixTableSeeder.php +++ b/database/seeders/AdditionalFormatPrefixTableSeeder.php @@ -9,10 +9,8 @@ class AdditionalFormatPrefixTableSeeder extends Seeder { /** * Run the database seeds. - * - * @return void */ - public function run() + public function run(): void { $associations[] = ['format_id' => 58, 'prefix_id' => 87, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()]; $associations[] = ['format_id' => 58, 'prefix_id' => 7, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()]; diff --git a/database/seeders/CollectionTypesSeeder.php b/database/seeders/CollectionTypesSeeder.php index 3fd47c65..6d8048a1 100644 --- a/database/seeders/CollectionTypesSeeder.php +++ b/database/seeders/CollectionTypesSeeder.php @@ -9,10 +9,8 @@ class CollectionTypesSeeder extends Seeder { /** * Run the database seeds. - * - * @return void */ - public function run() + public function run(): void { $collectionTypes[] = ['id' => 1, 'name' => 'NCCPA', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()]; $collectionTypes[] = ['id' => 2, 'name' => 'RBC', 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()]; diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 5d78e3e2..ed054291 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -9,10 +9,8 @@ class DatabaseSeeder extends Seeder { /** * Run the database seeds. - * - * @return void */ - public function run() + public function run(): void { Model::unguard(); diff --git a/database/seeders/FormatPrefixTableSeeder.php b/database/seeders/FormatPrefixTableSeeder.php index 0d0528af..8d54e3ad 100644 --- a/database/seeders/FormatPrefixTableSeeder.php +++ b/database/seeders/FormatPrefixTableSeeder.php @@ -9,10 +9,8 @@ class FormatPrefixTableSeeder extends Seeder { /** * Run the database seeds. - * - * @return void */ - public function run() + public function run(): void { $associations[] = ['format_id' => 1, 'prefix_id' => 1, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()]; $associations[] = ['format_id' => 2, 'prefix_id' => 1, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()]; diff --git a/database/seeders/PrefixesTableSeeder.php b/database/seeders/PrefixesTableSeeder.php index cf42e959..4fb84f55 100644 --- a/database/seeders/PrefixesTableSeeder.php +++ b/database/seeders/PrefixesTableSeeder.php @@ -9,10 +9,8 @@ class PrefixesTableSeeder extends Seeder { /** * Run the database seeds. - * - * @return void */ - public function run() + public function run(): void { $ncpaId = 1; $rbcId = 2; diff --git a/database/seeders/UsersTableSeeder.php b/database/seeders/UsersTableSeeder.php index 06403f0c..76c5a11c 100644 --- a/database/seeders/UsersTableSeeder.php +++ b/database/seeders/UsersTableSeeder.php @@ -10,10 +10,8 @@ class UsersTableSeeder extends Seeder { /** * Run the database seeds. - * - * @return void */ - public function run() + public function run(): void { if (env('APP_ENV') !== 'production') { $password = Hash::make(env('ADMIN_USER_PASSWORD')); diff --git a/lang/en/auth.php b/lang/en/auth.php deleted file mode 100644 index 6598e2c0..00000000 --- a/lang/en/auth.php +++ /dev/null @@ -1,20 +0,0 @@ - 'These credentials do not match our records.', - 'password' => 'The provided password is incorrect.', - 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', - -]; diff --git a/lang/en/pagination.php b/lang/en/pagination.php deleted file mode 100644 index d4814118..00000000 --- a/lang/en/pagination.php +++ /dev/null @@ -1,19 +0,0 @@ - '« Previous', - 'next' => 'Next »', - -]; diff --git a/lang/en/passwords.php b/lang/en/passwords.php deleted file mode 100644 index 7c10cba1..00000000 --- a/lang/en/passwords.php +++ /dev/null @@ -1,22 +0,0 @@ - 'Passwords must be at least six characters and match the confirmation.', - 'user' => "We can't find a user with that e-mail address.", - 'token' => 'This password reset token is invalid.', - 'sent' => 'We have e-mailed your password reset link!', - 'reset' => 'Your password has been reset!', - -]; diff --git a/lang/en/validation.php b/lang/en/validation.php deleted file mode 100644 index cef02f58..00000000 --- a/lang/en/validation.php +++ /dev/null @@ -1,170 +0,0 @@ - 'The :attribute must be accepted.', - 'accepted_if' => 'The :attribute must be accepted when :other is :value.', - 'active_url' => 'The :attribute is not a valid URL.', - 'after' => 'The :attribute must be a date after :date.', - 'after_or_equal' => 'The :attribute must be a date after or equal to :date.', - 'alpha' => 'The :attribute must only contain letters.', - 'alpha_dash' => 'The :attribute must only contain letters, numbers, dashes and underscores.', - 'alpha_num' => 'The :attribute must only contain letters and numbers.', - 'array' => 'The :attribute must be an array.', - 'before' => 'The :attribute must be a date before :date.', - 'before_or_equal' => 'The :attribute must be a date before or equal to :date.', - 'between' => [ - 'array' => 'The :attribute must have between :min and :max items.', - 'file' => 'The :attribute must be between :min and :max kilobytes.', - 'numeric' => 'The :attribute must be between :min and :max.', - 'string' => 'The :attribute must be between :min and :max characters.', - ], - 'boolean' => 'The :attribute field must be true or false.', - 'confirmed' => 'The :attribute confirmation does not match.', - 'current_password' => 'The password is incorrect.', - 'date' => 'The :attribute is not a valid date.', - 'date_equals' => 'The :attribute must be a date equal to :date.', - 'date_format' => 'The :attribute does not match the format :format.', - 'declined' => 'The :attribute must be declined.', - 'declined_if' => 'The :attribute must be declined when :other is :value.', - 'different' => 'The :attribute and :other must be different.', - 'digits' => 'The :attribute must be :digits digits.', - 'digits_between' => 'The :attribute must be between :min and :max digits.', - 'dimensions' => 'The :attribute has invalid image dimensions.', - 'distinct' => 'The :attribute field has a duplicate value.', - 'doesnt_start_with' => 'The :attribute may not start with one of the following: :values.', - 'email' => 'The :attribute must be a valid email address.', - 'ends_with' => 'The :attribute must end with one of the following: :values.', - 'enum' => 'The selected :attribute is invalid.', - 'exists' => 'The selected :attribute is invalid.', - 'file' => 'The :attribute must be a file.', - 'filled' => 'The :attribute field must have a value.', - 'gt' => [ - 'array' => 'The :attribute must have more than :value items.', - 'file' => 'The :attribute must be greater than :value kilobytes.', - 'numeric' => 'The :attribute must be greater than :value.', - 'string' => 'The :attribute must be greater than :value characters.', - ], - 'gte' => [ - 'array' => 'The :attribute must have :value items or more.', - 'file' => 'The :attribute must be greater than or equal to :value kilobytes.', - 'numeric' => 'The :attribute must be greater than or equal to :value.', - 'string' => 'The :attribute must be greater than or equal to :value characters.', - ], - 'image' => 'The :attribute must be an image.', - 'in' => 'The selected :attribute is invalid.', - 'in_array' => 'The :attribute field does not exist in :other.', - 'integer' => 'The :attribute must be an integer.', - 'ip' => 'The :attribute must be a valid IP address.', - 'ipv4' => 'The :attribute must be a valid IPv4 address.', - 'ipv6' => 'The :attribute must be a valid IPv6 address.', - 'json' => 'The :attribute must be a valid JSON string.', - 'lt' => [ - 'array' => 'The :attribute must have less than :value items.', - 'file' => 'The :attribute must be less than :value kilobytes.', - 'numeric' => 'The :attribute must be less than :value.', - 'string' => 'The :attribute must be less than :value characters.', - ], - 'lte' => [ - 'array' => 'The :attribute must not have more than :value items.', - 'file' => 'The :attribute must be less than or equal to :value kilobytes.', - 'numeric' => 'The :attribute must be less than or equal to :value.', - 'string' => 'The :attribute must be less than or equal to :value characters.', - ], - 'mac_address' => 'The :attribute must be a valid MAC address.', - 'max' => [ - 'array' => 'The :attribute must not have more than :max items.', - 'file' => 'The :attribute must not be greater than :max kilobytes.', - 'numeric' => 'The :attribute must not be greater than :max.', - 'string' => 'The :attribute must not be greater than :max characters.', - ], - 'mimes' => 'The :attribute must be a file of type: :values.', - 'mimetypes' => 'The :attribute must be a file of type: :values.', - 'min' => [ - 'array' => 'The :attribute must have at least :min items.', - 'file' => 'The :attribute must be at least :min kilobytes.', - 'numeric' => 'The :attribute must be at least :min.', - 'string' => 'The :attribute must be at least :min characters.', - ], - 'multiple_of' => 'The :attribute must be a multiple of :value.', - 'not_in' => 'The selected :attribute is invalid.', - 'not_regex' => 'The :attribute format is invalid.', - 'numeric' => 'The :attribute must be a number.', - 'password' => [ - 'letters' => 'The :attribute must contain at least one letter.', - 'mixed' => 'The :attribute must contain at least one uppercase and one lowercase letter.', - 'numbers' => 'The :attribute must contain at least one number.', - 'symbols' => 'The :attribute must contain at least one symbol.', - 'uncompromised' => 'The given :attribute has appeared in a data leak. Please choose a different :attribute.', - ], - 'present' => 'The :attribute field must be present.', - 'prohibited' => 'The :attribute field is prohibited.', - 'prohibited_if' => 'The :attribute field is prohibited when :other is :value.', - 'prohibited_unless' => 'The :attribute field is prohibited unless :other is in :values.', - 'prohibits' => 'The :attribute field prohibits :other from being present.', - 'regex' => 'The :attribute format is invalid.', - 'required' => 'The :attribute field is required.', - 'required_array_keys' => 'The :attribute field must contain entries for: :values.', - 'required_if' => 'The :attribute field is required when :other is :value.', - 'required_unless' => 'The :attribute field is required unless :other is in :values.', - 'required_with' => 'The :attribute field is required when :values is present.', - 'required_with_all' => 'The :attribute field is required when :values are present.', - 'required_without' => 'The :attribute field is required when :values is not present.', - 'required_without_all' => 'The :attribute field is required when none of :values are present.', - 'same' => 'The :attribute and :other must match.', - 'size' => [ - 'array' => 'The :attribute must contain :size items.', - 'file' => 'The :attribute must be :size kilobytes.', - 'numeric' => 'The :attribute must be :size.', - 'string' => 'The :attribute must be :size characters.', - ], - 'starts_with' => 'The :attribute must start with one of the following: :values.', - 'string' => 'The :attribute must be a string.', - 'timezone' => 'The :attribute must be a valid timezone.', - 'unique' => 'The :attribute has already been taken.', - 'uploaded' => 'The :attribute failed to upload.', - 'url' => 'The :attribute must be a valid URL.', - 'uuid' => 'The :attribute must be a valid UUID.', - - /* - |-------------------------------------------------------------------------- - | Custom Validation Language Lines - |-------------------------------------------------------------------------- - | - | Here you may specify custom validation messages for attributes using the - | convention "attribute.rule" to name the lines. This makes it quick to - | specify a specific custom language line for a given attribute rule. - | - */ - - 'custom' => [ - 'attribute-name' => [ - 'rule-name' => 'custom-message', - ], - ], - - /* - |-------------------------------------------------------------------------- - | Custom Validation Attributes - |-------------------------------------------------------------------------- - | - | The following language lines are used to swap our attribute placeholder - | with something more reader friendly such as "E-Mail Address" instead - | of "email". This simply helps us make our message more expressive. - | - */ - - 'attributes' => [], - -]; diff --git a/phpunit.xml b/phpunit.xml index 15896bcf..c8ea785d 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -16,7 +16,7 @@ - + diff --git a/public/index.php b/public/index.php index 4866dca3..947d9896 100644 --- a/public/index.php +++ b/public/index.php @@ -1,54 +1,17 @@ make(Kernel::class); - -$response = $kernel->handle( - $request = Request::capture() -)->send(); +// Register the Composer autoloader... +require __DIR__.'/../vendor/autoload.php'; -$kernel->terminate($request, $response); +// Bootstrap Laravel and handle the request... +(require_once __DIR__.'/../bootstrap/app.php') + ->handleRequest(Request::capture()); diff --git a/routes/api.php b/routes/api.php deleted file mode 100644 index 6b907f39..00000000 --- a/routes/api.php +++ /dev/null @@ -1,18 +0,0 @@ -user(); -})->middleware('auth:api'); diff --git a/routes/console.php b/routes/console.php index 75dd0cde..d8628218 100644 --- a/routes/console.php +++ b/routes/console.php @@ -1,18 +1,20 @@ comment(Inspiring::quote()); -})->describe('Display an inspiring quote'); +})->purpose('Display an inspiring quote'); + +// Generate the activity stream +Schedule::call(function () { + $activityStream = new ActivityStream; + $activityStream->generate(); +})->name('generateActivityStream') + ->everyMinute() + ->timezone('America/New_York') + ->between('7:00', '18:00') + ->withoutOverlapping(15); diff --git a/tests/Browser/LoginTest.php b/tests/Browser/LoginTest.php index 23320a4e..d6ca8f90 100644 --- a/tests/Browser/LoginTest.php +++ b/tests/Browser/LoginTest.php @@ -12,7 +12,7 @@ class LoginTest extends DuskTestCase use DatabaseMigrations; // this test uses a non LDAP login method that only works on a local or test environment - public function testLoggingInWorks() + public function test_logging_in_works(): void { User::factory()->create([ 'username' => 'best_user', @@ -21,10 +21,10 @@ public function testLoggingInWorks() $this->browse(function (Browser $browser) { $browser->visit('/login') - ->type('username', 'best_user') - ->type('password', 'password') - ->press('Sign In') - ->assertPathIs('/dashboard'); + ->type('username', 'best_user') + ->type('password', 'password') + ->press('Sign In') + ->assertPathIs('/dashboard'); }); } } diff --git a/tests/Browser/NewAudioVisualItemTest.php b/tests/Browser/NewAudioVisualItemTest.php index cb563367..74e00c49 100644 --- a/tests/Browser/NewAudioVisualItemTest.php +++ b/tests/Browser/NewAudioVisualItemTest.php @@ -15,7 +15,7 @@ class NewAudioVisualItemTest extends DuskTestCase { use DatabaseMigrations; - public function testNewFormCreatesNewAudioVisualItem() + public function test_new_form_creates_new_audio_visual_item(): void { User::factory()->create(); $collection = Collection::factory()->create(); @@ -32,16 +32,15 @@ public function testNewFormCreatesNewAudioVisualItem() $this->browse(function (Browser $browser) { $browser->loginAs(User::find(1)) - ->visit('/items') - ->clickLink('New') - ->assertSee('Create Audio Visual Item') - - ->type('title', 'Example Title') - ->select('collection_id', 1) - ->select('format_id', 1) - ->press('Save') - ->assertPathIs('/items/1') - ->assertSee('Audio Item Details'); + ->visit('/items') + ->clickLink('New') + ->assertSee('Create Audio Visual Item') + ->type('title', 'Example Title') + ->select('collection_id', 1) + ->select('format_id', 1) + ->press('Save') + ->assertPathIs('/items/1') + ->assertSee('Audio Item Details'); }); } } diff --git a/tests/Browser/NewCutTest.php b/tests/Browser/NewCutTest.php index 970c9157..cf68b98c 100644 --- a/tests/Browser/NewCutTest.php +++ b/tests/Browser/NewCutTest.php @@ -31,37 +31,35 @@ protected function setUp(): void TestHelper::addUserIdToRevision('Transfer', $this->transfer->id, $this->user->id); } - public function testUserIsAbleToAddCutWhenNecessary(): void + public function test_user_is_able_to_add_cut_when_necessary(): void { $this->browse(function (Browser $browser) { $path = '/transfers/'.$this->transfer->id; $browser->loginAs($this->user->id) - ->visit($path) - ->assertSee('Add Cut') - - ->clickLink('Add Cut') - ->assertPathBeginsWith('/cuts/create') - ->type('side', '1') - ->press('Save') - ->assertPathIs($path) - ->assertSee('Related Cut'); + ->visit($path) + ->assertSee('Add Cut') + ->clickLink('Add Cut') + ->assertPathBeginsWith('/cuts/create') + ->type('side', '1') + ->press('Save') + ->assertPathIs($path) + ->assertSee('Related Cut'); }); } - public function testUserMayEditCut(): void + public function test_user_may_edit_cut(): void { $this->browse(function (Browser $browser) { $cut = Cut::factory()->create(); TestHelper::addUserIdToRevision('Cut', $cut->id, $this->user->id); $browser->loginAs($this->user->id) - ->visit('/cuts/'.$cut->id.'?instanceId='.$cut->preservation_instance_id) - ->clickLink('Edit') - ->assertPathIs('/cuts/'.$cut->id.'/edit') - - ->type('title', 'The best film ever') - ->press('Save') - ->assertPathIs('/cuts/'.$cut->id); + ->visit('/cuts/'.$cut->id.'?instanceId='.$cut->preservation_instance_id) + ->clickLink('Edit') + ->assertPathIs('/cuts/'.$cut->id.'/edit') + ->type('title', 'The best film ever') + ->press('Save') + ->assertPathIs('/cuts/'.$cut->id); }); } } diff --git a/tests/Browser/Pages/HomePage.php b/tests/Browser/Pages/HomePage.php index 26bf174f..c04a7f0a 100644 --- a/tests/Browser/Pages/HomePage.php +++ b/tests/Browser/Pages/HomePage.php @@ -19,7 +19,6 @@ public function url() /** * Assert that the browser is on the page. * - * @param \Laravel\Dusk\Browser $browser * @return void */ public function assert(Browser $browser) diff --git a/tests/Browser/SelectAllTest.php b/tests/Browser/SelectAllTest.php index 5a0da6d6..21daef02 100644 --- a/tests/Browser/SelectAllTest.php +++ b/tests/Browser/SelectAllTest.php @@ -14,19 +14,17 @@ class SelectAllTest extends DuskTestCase /** * A Dusk test example. - * - * @return void */ - public function testSelectAllWorks() + public function test_select_all_works(): void { User::factory()->create(); $this->browse(function (Browser $browser) { $browser->loginAs(User::find(1)) - ->visit('/instances') - ->keys('#search', 'general', '{enter}') - ->pause(1000) - ->click('table > thead > tr > th') - ->driver->getKeyboard()->sendKeys([WebDriverKeys::COMMAND, 'a']); + ->visit('/instances') + ->keys('#search', 'general', '{enter}') + ->pause(1000) + ->click('table > thead > tr > th') + ->driver->getKeyboard()->sendKeys([WebDriverKeys::COMMAND, 'a']); $browser->pause(10000)->assertPresent('.selected'); }); diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php deleted file mode 100644 index 547152f6..00000000 --- a/tests/CreatesApplication.php +++ /dev/null @@ -1,22 +0,0 @@ -make(Kernel::class)->bootstrap(); - - return $app; - } -} diff --git a/tests/DuskTestCase.php b/tests/DuskTestCase.php index 7db82365..82f51cc1 100644 --- a/tests/DuskTestCase.php +++ b/tests/DuskTestCase.php @@ -9,8 +9,6 @@ abstract class DuskTestCase extends BaseTestCase { - use CreatesApplication; - /** * Prepare for Dusk test execution. * diff --git a/tests/Feature/AdminTest.php b/tests/Feature/AdminTest.php index a67780dc..39f1fe39 100644 --- a/tests/Feature/AdminTest.php +++ b/tests/Feature/AdminTest.php @@ -15,7 +15,7 @@ protected function setUp(): void $this->adminUser = User::factory()->create(['admin' => 1]); } - public function testUserIsMadeAdminAppropriately(): void + public function test_user_is_made_admin_appropriately(): void { $regularUser = User::factory()->create(['inactive' => 0, 'admin' => 0]); $adminUser = $this->adminUser; @@ -31,23 +31,23 @@ public function testUserIsMadeAdminAppropriately(): void $response->assertSuccessful(); } - public function testInactiveUserIsNotMadeAdmin(): void + public function test_inactive_user_is_not_made_admin(): void { $inactiveUser = User::factory()->create(['inactive' => 1]); $adminUser = $this->adminUser; $response = $this->actingAs($adminUser) - ->post('/admin/make-admin', - [ - 'username' => $inactiveUser->username, - ], - ['HTTP_X-Requested-With' => 'XMLHttpRequest']); + ->post('/admin/make-admin', + [ + 'username' => $inactiveUser->username, + ], + ['HTTP_X-Requested-With' => 'XMLHttpRequest']); $this->assertEquals(0, User::find($inactiveUser->id)->admin); $response->assertStatus(422); } - public function testAdminUserHasAdminStatusRemovedAppropriately(): void + public function test_admin_user_has_admin_status_removed_appropriately(): void { $adminUser1 = User::factory()->create(['admin' => 1]); $adminUser = $this->adminUser; diff --git a/tests/Feature/AudioVisualItemsTest.php b/tests/Feature/AudioVisualItemsTest.php index 0d747a9a..8622a933 100644 --- a/tests/Feature/AudioVisualItemsTest.php +++ b/tests/Feature/AudioVisualItemsTest.php @@ -28,13 +28,11 @@ protected function setUp(): void /** * A basic feature test example. - * - * @return void */ public function test_show_accurately_returns(): void { $response = $this->actingAs($this->user) - ->get('/items/'.$this->avItem->id); + ->get('/items/'.$this->avItem->id); $response->assertStatus(200); $response->assertViewIs('items.show'); @@ -45,7 +43,7 @@ public function test_create_displays_form(): void Collection::factory()->count(3)->create(); Format::factory()->count(3)->create(); $response = $this->actingAs($this->user) - ->get('/items/create'); + ->get('/items/create'); $response->assertStatus(200); $response->assertViewIs('items.create'); @@ -62,16 +60,16 @@ public function test_store_saves_new_item(): void 'next' => 1, ]); $response = $this->actingAs($this->user) - ->post('/items', - [ - 'batch_size' => 2, - 'title' => 'The Newest Title', - 'collection_id' => $collection->id, - 'format_id' => $format->id, - 'entry_date' => '2021-10-18', - 'subclass_type' => 'AudioItem', - 'subclass' => ['size' => 12], - ]); + ->post('/items', + [ + 'batch_size' => 2, + 'title' => 'The Newest Title', + 'collection_id' => $collection->id, + 'format_id' => $format->id, + 'entry_date' => '2021-10-18', + 'subclass_type' => 'AudioItem', + 'subclass' => ['size' => 12], + ]); $newItem = AudioVisualItem::all()->last(); $response->assertRedirect('/items/'.$newItem->id); $this->assertEquals('The Newest Title', $newItem->title, 'Test did not create AV Item with the right title'); @@ -82,7 +80,7 @@ public function test_edit_displays_form(): void Collection::factory()->count(3)->create(); Format::factory()->count(3)->create(); $response = $this->actingAs($this->user) - ->get('/items/'.$this->avItem->id.'/edit'); + ->get('/items/'.$this->avItem->id.'/edit'); $response->assertStatus(200); $response->assertViewIs('items.edit'); @@ -108,7 +106,7 @@ public function test_update_edits_item(): void ]; $response = $this->actingAs($this->user) - ->put('/items/'.$id, $parameters); + ->put('/items/'.$id, $parameters); $response->assertRedirect('/items/'.$id); $this->assertNotEquals($title, AudioVisualItem::find($id)->title, 'AV Item title should have updated.'); @@ -118,7 +116,7 @@ public function test_destroy_deletes_item(): void { $id = $this->avItem->id; $response = $this->actingAs($this->user) - ->delete('/items/'.$id); + ->delete('/items/'.$id); $response->assertRedirect('/items'); $this->assertNull(AudioVisualItem::find($id)); diff --git a/tests/Feature/CollectionTypesTest.php b/tests/Feature/CollectionTypesTest.php index 6aa542e2..8c54d5c1 100644 --- a/tests/Feature/CollectionTypesTest.php +++ b/tests/Feature/CollectionTypesTest.php @@ -25,7 +25,7 @@ protected function setUp(): void $this->user = User::factory()->create(['admin' => 0]); } - public function testIndexRedirectsNonAdminUser() + public function test_index_redirects_non_admin_user(): void { $user = $this->user; $this->be($user); @@ -35,7 +35,7 @@ public function testIndexRedirectsNonAdminUser() $response->assertRedirect('/dashboard'); } - public function testIndexRespondsSuccessfully() + public function test_index_responds_successfully(): void { $adminUser = $this->adminUser; $this->be($adminUser); @@ -44,7 +44,7 @@ public function testIndexRespondsSuccessfully() $this->assertEquals(200, $response->getStatusCode()); } - public function testStoreCreatesNewCollectionType() + public function test_store_creates_new_collection_type(): void { $adminUser = $this->adminUser; $this->be($adminUser); @@ -58,7 +58,7 @@ public function testStoreCreatesNewCollectionType() $this->assertEquals(200, $response->getStatusCode()); } - public function testUpdateEditsCollectionType() + public function test_update_edits_collection_type(): void { $collectionType = CollectionType::factory()->create(['name' => 'SFC Collection']); $newName = 'Amazing SFC Collection'; @@ -74,7 +74,7 @@ public function testUpdateEditsCollectionType() $this->assertEquals(200, $response->getStatusCode(), 'Did not get a successful response.'); } - public function testDeleteDoesNotWorkOnCollectionTypeInUse() + public function test_delete_does_not_work_on_collection_type_in_use(): void { $collectionType = CollectionType::factory()->create(); Collection::factory()->create(['collection_type_id' => $collectionType->id]); @@ -92,7 +92,7 @@ public function testDeleteDoesNotWorkOnCollectionTypeInUse() 'and/or prefixes before deleting.', ]]); } - public function testDeleteRemovesUnusedCollectionType() + public function test_delete_removes_unused_collection_type(): void { $collectionType = CollectionType::factory()->create(['deleted_at' => null]); $adminUser = $this->adminUser; diff --git a/tests/Feature/FormatsTest.php b/tests/Feature/FormatsTest.php index c72c8b2e..a3fe4c21 100644 --- a/tests/Feature/FormatsTest.php +++ b/tests/Feature/FormatsTest.php @@ -23,7 +23,7 @@ protected function setUp(): void $this->prefix = Prefix::factory()->create(); } - public function testAttachPrefixes() + public function test_attach_prefixes(): void { $adminUser = $this->adminUser; $format = $this->format; @@ -41,7 +41,7 @@ public function testAttachPrefixes() $this->assertEquals(200, $response->getStatusCode()); } - public function testDetachPrefixes() + public function test_detach_prefixes(): void { $adminUser = $this->adminUser; $format = $this->format; diff --git a/tests/Feature/ItemsImportTest.php b/tests/Feature/ItemsImportTest.php index 58d9010b..8f3a531a 100644 --- a/tests/Feature/ItemsImportTest.php +++ b/tests/Feature/ItemsImportTest.php @@ -37,7 +37,7 @@ protected function setUp(): void $this->prefix = TestHelper::createAndAttachPrefix($this->collection1, $this->format); } - public function testItemsImportUpload(): void + public function test_items_import_upload(): void { $user = $this->user; $filePath = base_path('tests/import-test-files/items-import/small_items_import.csv'); @@ -55,16 +55,16 @@ public function testItemsImportUpload(): void $this->assertFileExists("{$path}/{$filename}.csv"); } - public function testItemsImportUploadExecuteWithErrors(): void + public function test_items_import_upload_execute_with_errors(): void { $user = $this->user; $filePath = base_path('tests/import-test-files/items-import/sample_items_import_mixed_errors.csv'); $response = $this->actingAs($user) - ->withSession(['items-import-file' => $filePath]) - ->post('/items/batch/audio-import-execute', - [], - ['HTTP_X-Requested-With' => 'XMLHttpRequest']); + ->withSession(['items-import-file' => $filePath]) + ->post('/items/batch/audio-import-execute', + [], + ['HTTP_X-Requested-With' => 'XMLHttpRequest']); $responseArray = json_decode($response->getContent(), true); // see if the response html includes the uploaded file error string @@ -74,7 +74,7 @@ public function testItemsImportUploadExecuteWithErrors(): void $this->assertTrue($htmlContainsErrorMessage, 'The HTML in the response does not include the correct error notification.'); } - public function testItemsImportNewUploadExecuteWithSuccess(): void + public function test_items_import_new_upload_execute_with_success(): void { NewCallNumberSequence::factory()->create([ 'prefix' => $this->prefix->label, @@ -85,10 +85,10 @@ public function testItemsImportNewUploadExecuteWithSuccess(): void $filePath = base_path('tests/import-test-files/items-import/small_items_import.csv'); $response = $this->actingAs($user) - ->withSession(['items-import-file' => $filePath]) - ->post('/items/batch/audio-import-execute', - [], - ['HTTP_X-Requested-With' => 'XMLHttpRequest']); + ->withSession(['items-import-file' => $filePath]) + ->post('/items/batch/audio-import-execute', + [], + ['HTTP_X-Requested-With' => 'XMLHttpRequest']); $responseArray = json_decode($response->getContent(), true); $htmlContainsSuccessMessage = strpos($responseArray['html'], 'Your import was successful!') !== false; @@ -97,7 +97,7 @@ public function testItemsImportNewUploadExecuteWithSuccess(): void $this->assertTrue($htmlContainsSuccessMessage, 'The HTML in the response does not include the correct success notification.'); } - public function testItemsImportUpdateExecuteWithSuccess(): void + public function test_items_import_update_execute_with_success(): void { NewCallNumberSequence::factory()->create([ 'prefix' => $this->prefix->label, @@ -108,10 +108,10 @@ public function testItemsImportUpdateExecuteWithSuccess(): void $filePath = base_path('tests/import-test-files/items-import/items_import_with_call_number.csv'); $response = $this->actingAs($user) - ->withSession(['items-import-file' => $filePath]) - ->post('/items/batch/audio-import-execute', - [], - ['HTTP_X-Requested-With' => 'XMLHttpRequest']); + ->withSession(['items-import-file' => $filePath]) + ->post('/items/batch/audio-import-execute', + [], + ['HTTP_X-Requested-With' => 'XMLHttpRequest']); $responseArray = json_decode($response->getContent(), true); $htmlContainsSuccessMessage = strpos($responseArray['html'], 'Your import was successful!') !== false; @@ -120,7 +120,7 @@ public function testItemsImportUpdateExecuteWithSuccess(): void $this->assertTrue($htmlContainsSuccessMessage, 'The HTML in the response does not include the correct success notification.'); } - public function testItemsImportUpdateActuallyUpdates(): void + public function test_items_import_update_actually_updates(): void { $avItem = $this->audioVisualItem1; NewCallNumberSequence::factory()->create([ @@ -132,26 +132,26 @@ public function testItemsImportUpdateActuallyUpdates(): void $filePath = base_path('tests/import-test-files/items-import/items_import_with_call_number.csv'); $this->actingAs($user) - ->withSession(['items-import-file' => $filePath]) - ->post('/items/batch/audio-import-execute', - [], - ['HTTP_X-Requested-With' => 'XMLHttpRequest']); + ->withSession(['items-import-file' => $filePath]) + ->post('/items/batch/audio-import-execute', + [], + ['HTTP_X-Requested-With' => 'XMLHttpRequest']); $updatedTitle = $avItem->fresh()->title; $this->assertEquals('Test open reel 1', $updatedTitle, "The audiovisual item's title was not updated."); } - public function testItemsImportValidationNoCallNumberSequence(): void + public function test_items_import_validation_no_call_number_sequence(): void { $user = $this->user; $filePath = base_path('tests/import-test-files/items-import/small_items_import.csv'); $response = $this->actingAs($user) - ->withSession(['items-import-file' => $filePath]) - ->post('/items/batch/audio-import-execute', - [], - ['HTTP_X-Requested-With' => 'XMLHttpRequest']); + ->withSession(['items-import-file' => $filePath]) + ->post('/items/batch/audio-import-execute', + [], + ['HTTP_X-Requested-With' => 'XMLHttpRequest']); $responseArray = json_decode($response->getContent(), true); $htmlContainsErrorMessage = strpos($responseArray['html'], @@ -161,16 +161,16 @@ public function testItemsImportValidationNoCallNumberSequence(): void $this->assertTrue($htmlContainsErrorMessage, 'The HTML in the response does not include the correct error notification.'); } - public function testItemsImportValidationMustAlreadyExistInDatabase(): void + public function test_items_import_validation_must_already_exist_in_database(): void { $user = $this->user; $filePath = base_path('tests/import-test-files/items-import/sample_items_import_mixed_errors.csv'); $response = $this->actingAs($user) - ->withSession(['items-import-file' => $filePath]) - ->post('/items/batch/audio-import-execute', - [], - ['HTTP_X-Requested-With' => 'XMLHttpRequest']); + ->withSession(['items-import-file' => $filePath]) + ->post('/items/batch/audio-import-execute', + [], + ['HTTP_X-Requested-With' => 'XMLHttpRequest']); $responseArray = json_decode($response->getContent(), true); $htmlContainsErrorMessage = strpos($responseArray['html'], @@ -180,7 +180,7 @@ public function testItemsImportValidationMustAlreadyExistInDatabase(): void $this->assertTrue($htmlContainsErrorMessage, 'The HTML in the response does not include the correct error notification.'); } - public function testItemsImportUpdateSetsAccessRestrictionInTitleCase(): void + public function test_items_import_update_sets_access_restriction_in_title_case(): void { $avItem = $this->audioVisualItem1; NewCallNumberSequence::factory()->create([ @@ -192,10 +192,10 @@ public function testItemsImportUpdateSetsAccessRestrictionInTitleCase(): void $filePath = base_path('tests/import-test-files/items-import/items_import_with_call_number.csv'); $this->actingAs($user) - ->withSession(['items-import-file' => $filePath]) - ->post('/items/batch/audio-import-execute', - [], - ['HTTP_X-Requested-With' => 'XMLHttpRequest']); + ->withSession(['items-import-file' => $filePath]) + ->post('/items/batch/audio-import-execute', + [], + ['HTTP_X-Requested-With' => 'XMLHttpRequest']); $updatedAccessRestriction = $avItem->fresh()->access_restrictions; diff --git a/tests/Feature/PrefixesTest.php b/tests/Feature/PrefixesTest.php index 99197e71..e9f0426d 100644 --- a/tests/Feature/PrefixesTest.php +++ b/tests/Feature/PrefixesTest.php @@ -29,7 +29,7 @@ protected function setUp(): void $this->collectionType = CollectionType::factory()->create(['name' => 'SFC Collection']); } - public function testIndexRedirectsNonAdminUser() + public function test_index_redirects_non_admin_user(): void { $user = $this->user; $this->be($user); @@ -39,7 +39,7 @@ public function testIndexRedirectsNonAdminUser() $response->assertRedirect('/dashboard'); } - public function testIndexRespondsSuccessfully() + public function test_index_responds_successfully(): void { $adminUser = $this->adminUser; $this->be($adminUser); @@ -48,7 +48,7 @@ public function testIndexRespondsSuccessfully() $this->assertEquals(200, $response->getStatusCode()); } - public function testStoreCreatesNewPrefix() + public function test_store_creates_new_prefix(): void { $adminUser = $this->adminUser; $collectionType = $this->collectionType; @@ -64,7 +64,7 @@ public function testStoreCreatesNewPrefix() $this->assertEquals(200, $response->getStatusCode()); } - public function testUpdateEditsPrefix() + public function test_update_edits_prefix(): void { $collectionType = $this->collectionType; $prefix = Prefix::factory()->create(['label' => 'SFC', 'collection_type_id' => $collectionType->id]); @@ -83,7 +83,7 @@ public function testUpdateEditsPrefix() $this->assertEquals(200, $response->getStatusCode(), 'Did not get a successful response.'); } - public function testDeleteRemovesPrefixAndConnectionsToFormats() + public function test_delete_removes_prefix_and_connections_to_formats(): void { $prefix = Prefix::factory()->create(['deleted_at' => null]); $format1 = Format::factory()->create(); diff --git a/tests/Feature/RoutingTest.php b/tests/Feature/RoutingTest.php index f3ca12e5..bf727d65 100644 --- a/tests/Feature/RoutingTest.php +++ b/tests/Feature/RoutingTest.php @@ -9,17 +9,15 @@ class RoutingTest extends TestCase /** * A basic functional test example. - * - * @return void */ - public function testHomepageRedirectResponse() + public function test_homepage_redirect_response(): void { $response = $this->call('GET', '/'); $this->assertEquals(302, $response->getStatusCode()); } - public function testTransfersIndexResponse() + public function test_transfers_index_response(): void { $user = User::factory()->create(); $this->be($user); diff --git a/tests/Feature/TransferAudioImportsTest.php b/tests/Feature/TransferAudioImportsTest.php index 846cc67d..b69729e5 100644 --- a/tests/Feature/TransferAudioImportsTest.php +++ b/tests/Feature/TransferAudioImportsTest.php @@ -39,7 +39,7 @@ protected function setUp(): void AudioVisualItem::factory()->create(['speed' => '78 rpm']); } - public function testAudioImportUpload(): void + public function test_audio_import_upload(): void { $user = $this->user; $filePath = base_path('tests/import-test-files/audio-import/sample_audio_import_missing_original_pm_column.csv'); @@ -57,16 +57,16 @@ public function testAudioImportUpload(): void $this->assertFileExists("{$path}/{$filename}.csv"); } - public function testAudioImportUploadExecuteWithErrors(): void + public function test_audio_import_upload_execute_with_errors(): void { $user = $this->user; $filePath = base_path('tests/import-test-files/audio-import/small_import_non_validated.csv'); $response = $this->actingAs($user) - ->withSession(['audio-import-file' => $filePath]) - ->post('/transfers/batch/audio-import-execute', - [], - ['HTTP_X-Requested-With' => 'XMLHttpRequest']); + ->withSession(['audio-import-file' => $filePath]) + ->post('/transfers/batch/audio-import-execute', + [], + ['HTTP_X-Requested-With' => 'XMLHttpRequest']); $responseArray = json_decode($response->getContent(), true); // see if the response html includes the uploaded file error string @@ -76,16 +76,16 @@ public function testAudioImportUploadExecuteWithErrors(): void $this->assertTrue($htmlContainsErrorMessage, 'The HTML in the response does not include the correct error notification.'); } - public function testAudioImportUploadExecuteWithSuccess(): void + public function test_audio_import_upload_execute_with_success(): void { $user = $this->user; $filePath = base_path('tests/import-test-files/audio-import/small_upload_file_no_errors.csv'); $response = $this->actingAs($user) - ->withSession(['audio-import-file' => $filePath]) - ->post('/transfers/batch/audio-import-execute', - [], - ['HTTP_X-Requested-With' => 'XMLHttpRequest']); + ->withSession(['audio-import-file' => $filePath]) + ->post('/transfers/batch/audio-import-execute', + [], + ['HTTP_X-Requested-With' => 'XMLHttpRequest']); $responseArray = json_decode($response->getContent(), true); $htmlContainsSuccessMessage = strpos($responseArray['html'], 'Your import was successful!') !== false; @@ -94,17 +94,17 @@ public function testAudioImportUploadExecuteWithSuccess(): void $this->assertTrue($htmlContainsSuccessMessage, 'The HTML in the response does not include the correct success notification.'); } - public function testAudioImportUploadUpdateSizeWithSuccess(): void + public function test_audio_import_upload_update_size_with_success(): void { $user = $this->user; $avItem = $this->audioVisualItem1; $filePath = base_path('tests/import-test-files/audio-import/small_upload_file_no_errors.csv'); $response = $this->actingAs($user) - ->withSession(['audio-import-file' => $filePath]) - ->post('/transfers/batch/audio-import-execute', - [], - ['HTTP_X-Requested-With' => 'XMLHttpRequest']); + ->withSession(['audio-import-file' => $filePath]) + ->post('/transfers/batch/audio-import-execute', + [], + ['HTTP_X-Requested-With' => 'XMLHttpRequest']); $responseArray = json_decode($response->getContent(), true); $audioItem = $avItem->subclass; @@ -113,17 +113,17 @@ public function testAudioImportUploadUpdateSizeWithSuccess(): void $this->assertEquals('7"', $audioItem->size, 'The size column in the related AudioItem was not set correctly.'); } - public function testAudioImportUploadUpdateTrackConfigWithSuccess(): void + public function test_audio_import_upload_update_track_config_with_success(): void { $user = $this->user; $avItem = $this->audioVisualItem1; $filePath = base_path('tests/import-test-files/audio-import/small_upload_file_no_errors.csv'); $response = $this->actingAs($user) - ->withSession(['audio-import-file' => $filePath]) - ->post('/transfers/batch/audio-import-execute', - [], - ['HTTP_X-Requested-With' => 'XMLHttpRequest']); + ->withSession(['audio-import-file' => $filePath]) + ->post('/transfers/batch/audio-import-execute', + [], + ['HTTP_X-Requested-With' => 'XMLHttpRequest']); $responseArray = json_decode($response->getContent(), true); $audioItem = $avItem->subclass; @@ -133,17 +133,17 @@ public function testAudioImportUploadUpdateTrackConfigWithSuccess(): void 'The track configuration column in the related AudioItem was not set correctly.'); } - public function testAudioImportUploadUpdateBaseWithSuccess(): void + public function test_audio_import_upload_update_base_with_success(): void { $user = $this->user; $avItem = $this->audioVisualItem1; $filePath = base_path('tests/import-test-files/audio-import/small_upload_file_no_errors.csv'); $response = $this->actingAs($user) - ->withSession(['audio-import-file' => $filePath]) - ->post('/transfers/batch/audio-import-execute', - [], - ['HTTP_X-Requested-With' => 'XMLHttpRequest']); + ->withSession(['audio-import-file' => $filePath]) + ->post('/transfers/batch/audio-import-execute', + [], + ['HTTP_X-Requested-With' => 'XMLHttpRequest']); $responseArray = json_decode($response->getContent(), true); $audioItem = $avItem->subclass; @@ -153,17 +153,17 @@ public function testAudioImportUploadUpdateBaseWithSuccess(): void 'The base column in the related AudioItem was not set correctly.'); } - public function testAudioImportUploadUpdateSpeedWithSuccess(): void + public function test_audio_import_upload_update_speed_with_success(): void { $user = $this->user; $avItem = $this->audioVisualItem1; $filePath = base_path('tests/import-test-files/audio-import/small_upload_file_no_errors.csv'); $response = $this->actingAs($user) - ->withSession(['audio-import-file' => $filePath]) - ->post('/transfers/batch/audio-import-execute', - [], - ['HTTP_X-Requested-With' => 'XMLHttpRequest']); + ->withSession(['audio-import-file' => $filePath]) + ->post('/transfers/batch/audio-import-execute', + [], + ['HTTP_X-Requested-With' => 'XMLHttpRequest']); $responseArray = json_decode($response->getContent(), true); $avItemInDb = Jitterbug\Models\AudioVisualItem::find($avItem->id); @@ -172,7 +172,7 @@ public function testAudioImportUploadUpdateSpeedWithSuccess(): void 'The speed column in the AudioVisualItem entry was not set correctly.'); } - public function testAudioImportUploadUpdateWithUnusedHeadersMissing(): void + public function test_audio_import_upload_update_with_unused_headers_missing(): void { $user = $this->user; PreservationInstance::factory()->create(['id' => 82143, 'call_number' => 'FT-6708']); @@ -181,10 +181,10 @@ public function testAudioImportUploadUpdateWithUnusedHeadersMissing(): void $filePath = base_path('tests/import-test-files/audio-import/sample_audio_import_update_missing_headers.csv'); $response = $this->actingAs($user) - ->withSession(['audio-import-file' => $filePath]) - ->post('/transfers/batch/audio-import-execute', - [], - ['HTTP_X-Requested-With' => 'XMLHttpRequest']); + ->withSession(['audio-import-file' => $filePath]) + ->post('/transfers/batch/audio-import-execute', + [], + ['HTTP_X-Requested-With' => 'XMLHttpRequest']); $responseArray = json_decode($response->getContent(), true); $htmlContainsSuccessMessage = strpos($responseArray['html'], 'Your import was successful!') !== false; @@ -193,7 +193,7 @@ public function testAudioImportUploadUpdateWithUnusedHeadersMissing(): void $this->assertTrue($htmlContainsSuccessMessage, 'The HTML in the response does not include the correct success notification.'); } - public function testAudioImportUploadUpdateDoesNotUpdateBlankValues(): void + public function test_audio_import_upload_update_does_not_update_blank_values(): void { $user = $this->user; $preservationInstance = PreservationInstance::factory()->create(['id' => 82143, 'call_number' => 'FT-6708']); @@ -203,10 +203,10 @@ public function testAudioImportUploadUpdateDoesNotUpdateBlankValues(): void $filePath = base_path('tests/import-test-files/audio-import/sample_audio_import_update_missing_headers.csv'); $this->actingAs($user) - ->withSession(['audio-import-file' => $filePath]) - ->post('/transfers/batch/audio-import-execute', - [], - ['HTTP_X-Requested-With' => 'XMLHttpRequest']); + ->withSession(['audio-import-file' => $filePath]) + ->post('/transfers/batch/audio-import-execute', + [], + ['HTTP_X-Requested-With' => 'XMLHttpRequest']); $preservationInstance->refresh(); $this->assertEquals($originalFileName, $preservationInstance->file_name, 'The filename should be unchanged.'); diff --git a/tests/Feature/UsersTest.php b/tests/Feature/UsersTest.php index 2e484b32..1f5a1711 100644 --- a/tests/Feature/UsersTest.php +++ b/tests/Feature/UsersTest.php @@ -8,7 +8,7 @@ class UsersTest extends TestCase { use RefreshDatabase; - public function testInactivateSetsInactiveToTrue(): void + public function test_inactivate_sets_inactive_to_true(): void { $user = User::factory()->create(['inactive' => 0]); $adminUser = User::factory()->create(['admin' => 1]); @@ -23,7 +23,7 @@ public function testInactivateSetsInactiveToTrue(): void $this->assertEquals(200, $response->getStatusCode()); } - public function testInactivateDeletesUserMarks(): void + public function test_inactivate_deletes_user_marks(): void { $user = User::factory()->create(['inactive' => 0]); $adminUser = User::factory()->create(['admin' => 1]); @@ -42,7 +42,7 @@ public function testInactivateDeletesUserMarks(): void $this->assertEquals(200, $response->getStatusCode()); } - public function testReactivateSetsInactiveToFalse(): void + public function test_reactivate_sets_inactive_to_false(): void { $user = User::factory()->create(['inactive' => 1]); $adminUser = User::factory()->create(['admin' => 1]); diff --git a/tests/Helpers/TestHelper.php b/tests/Helpers/TestHelper.php index 80d11ee8..2000317d 100644 --- a/tests/Helpers/TestHelper.php +++ b/tests/Helpers/TestHelper.php @@ -13,9 +13,9 @@ class TestHelper public static function addUserIdToRevision($revisionableType, $revisionableId, $userId): void { $revision = Revision::where('revisionable_type', $revisionableType) - ->where('revisionable_id', $revisionableId) - ->get() - ->first(); + ->where('revisionable_id', $revisionableId) + ->get() + ->first(); $revision->user_id = $userId; $revision->save(); } diff --git a/tests/TestCase.php b/tests/TestCase.php index 8b5c76c9..916338c3 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -43,9 +43,7 @@ protected function getUploadableFile($file, $original_name, $type) class PassThroughHandler extends Jitterbug\Exceptions\Handler { - public function __construct() - { - } + public function __construct() {} public function report(Throwable $e) { diff --git a/tests/Unit/AudioVisualItemTest.php b/tests/Unit/AudioVisualItemTest.php index a43c0037..11dc6185 100644 --- a/tests/Unit/AudioVisualItemTest.php +++ b/tests/Unit/AudioVisualItemTest.php @@ -9,10 +9,8 @@ class AudioVisualItemTest extends TestCase /** * A basic test example. - * - * @return void */ - public function testTypeIdAttribute(): void + public function test_type_id_attribute(): void { $av_audio_item = AudioVisualItem::factory()->make(); $av_film_item = AudioVisualItem::factory()->make([ @@ -27,7 +25,7 @@ public function testTypeIdAttribute(): void $this->assertSame(3, $av_video_item->getTypeIdAttribute(), 'TypeIdAttribute returned wrong ID for Video Item'); } - public function testBlankDisplayAttributeWithRevisionable(): void + public function test_blank_display_attribute_with_revisionable(): void { $av_item = AudioVisualItem::factory()->make(); @@ -35,7 +33,7 @@ public function testBlankDisplayAttributeWithRevisionable(): void 'BlankDisplayAttribute should return yes when revisionable passes true in'); } - public function testBlankDisplayAttribute(): void + public function test_blank_display_attribute(): void { $av_item = AudioVisualItem::factory()->make(['blank' => true]); diff --git a/tests/Unit/CallNumberSequenceTest.php b/tests/Unit/CallNumberSequenceTest.php index 05835705..7308e043 100644 --- a/tests/Unit/CallNumberSequenceTest.php +++ b/tests/Unit/CallNumberSequenceTest.php @@ -34,7 +34,7 @@ protected function setUp(): void ]); } - public function testNextAlwaysUsesNewCallSequenceIfPrefixInNewStyleArray(): void + public function test_next_always_uses_new_call_sequence_if_prefix_in_new_style_array(): void { $format = Format::factory()->create(); $format->attachPrefixes($this->prefix->id); @@ -44,7 +44,7 @@ public function testNextAlwaysUsesNewCallSequenceIfPrefixInNewStyleArray(): void 'Sequence is not a NewCallNumberSequence, as it should be.'); } - public function testNextReturnsNewCallNumberSequenceIfItAlreadyExists(): void + public function test_next_returns_new_call_number_sequence_if_it_already_exists(): void { $callNumber = NewCallNumberSequence::factory()->create([ 'prefix' => $this->prefix->label, @@ -61,7 +61,7 @@ public function testNextReturnsNewCallNumberSequenceIfItAlreadyExists(): void 'Sequence is not a NewCallNumberSequence, as it should be.'); } - public function testNextReturnsExistingLegacyCallNumberSequenceIfNoNewCallNumberSequenceExists(): void + public function test_next_returns_existing_legacy_call_number_sequence_if_no_new_call_number_sequence_exists(): void { $prefix1 = Prefix::factory()->create([ 'label' => 'CD', @@ -85,7 +85,7 @@ public function testNextReturnsExistingLegacyCallNumberSequenceIfNoNewCallNumber 'Sequence is not the existing legacyCallNumberSequence, as it should be.'); } - public function testNextRaises404ErrorForMissingPrefix(): void + public function test_next_raises404_error_for_missing_prefix(): void { $format = Format::factory()->create(); // no prefixes have been attached to this format diff --git a/tests/Unit/NewCallNumberSequenceTest.php b/tests/Unit/NewCallNumberSequenceTest.php index ecf9b51d..749fe15b 100644 --- a/tests/Unit/NewCallNumberSequenceTest.php +++ b/tests/Unit/NewCallNumberSequenceTest.php @@ -8,7 +8,7 @@ class NewCallNumberSequenceTest extends TestCase { use RefreshDatabase; - public function testCallNumberUsesArchivalIdentifierInsteadOfCollectionId() + public function test_call_number_uses_archival_identifier_instead_of_collection_id(): void { $prefix = Prefix::factory()->create(['label' => 'TR']); $sequence = NewCallNumberSequence::factory()->create([ diff --git a/tests/Unit/PrefixTest.php b/tests/Unit/PrefixTest.php index 87b31eaf..7f0506b2 100644 --- a/tests/Unit/PrefixTest.php +++ b/tests/Unit/PrefixTest.php @@ -24,7 +24,7 @@ protected function setUp(): void $this->format = Format::factory()->create(); } - public function testFindPrefixLabelFindsLabelSuccessfully() + public function test_find_prefix_label_finds_label_successfully(): void { $collection = Collection::factory()->create(['collection_type_id' => 3]); @@ -34,7 +34,7 @@ public function testFindPrefixLabelFindsLabelSuccessfully() $this->assertEquals($this->prefix1->label, Prefix::findPrefixLabel($this->format->id, $collection->id)); } - public function testFindPrefixLabelRaisesExceptionForNullCollectionTypeId() + public function test_find_prefix_label_raises_exception_for_null_collection_type_id(): void { $this->expectException(NotFoundHttpException::class); Prefix::findPrefixLabel($this->format->id, 20001); diff --git a/tests/Unit/TransactionDigestTest.php b/tests/Unit/TransactionDigestTest.php index 6572f03b..5b27b6d6 100644 --- a/tests/Unit/TransactionDigestTest.php +++ b/tests/Unit/TransactionDigestTest.php @@ -24,7 +24,7 @@ class TransactionDigestTest extends TestCase protected function setUp(): void { parent::setUp(); - DirectoryEmulator::setup('default'); + DirectoryEmulator::setUp('default'); $this->transactionId = '12dh56kw345'; // unable to use a factory for Revision as it's a model in a separate package $this->revision = new Revision; @@ -37,10 +37,8 @@ protected function setUp(): void /** * A basic unit test example. - * - * @return void */ - public function testAnalyzeRevisionsWithUpdateImport(): void + public function test_analyze_revisions_with_update_import(): void { $this->importTransaction = ImportTransaction::factory()->create([ 'transaction_id' => $this->transactionId, @@ -51,7 +49,7 @@ public function testAnalyzeRevisionsWithUpdateImport(): void $this->assertEquals('updated via import', $transactionDigest->action); } - public function testAnalyzeRevisionsWithCreateImport(): void + public function test_analyze_revisions_with_create_import(): void { $this->importTransaction = ImportTransaction::factory()->create([ 'transaction_id' => $this->transactionId, @@ -62,7 +60,7 @@ public function testAnalyzeRevisionsWithCreateImport(): void $this->assertEquals('created via import', $transactionDigest->action); } - public function testAnalyzeRevisionsWithCreate(): void + public function test_analyze_revisions_with_create(): void { $this->revision->field = 'created_at'; $this->revision->save(); @@ -71,7 +69,7 @@ public function testAnalyzeRevisionsWithCreate(): void $this->assertEquals('created', $transactionDigest->action); } - public function testAnalyzeRevisionsWithUpdate(): void + public function test_analyze_revisions_with_update(): void { $this->revision->field = 'content_description'; $this->revision->save(); @@ -80,7 +78,7 @@ public function testAnalyzeRevisionsWithUpdate(): void $this->assertEquals('updated', $transactionDigest->action); } - public function testAnalyzeRevisionsWithDelete(): void + public function test_analyze_revisions_with_delete(): void { $this->revision->field = 'deleted_at'; $this->revision->save(); diff --git a/tests/Unit/TransferTest.php b/tests/Unit/TransferTest.php index 28e17085..1fe93884 100644 --- a/tests/Unit/TransferTest.php +++ b/tests/Unit/TransferTest.php @@ -8,14 +8,14 @@ class TransferTest extends TestCase { use RefreshDatabase; - public function testEngineerNameAttributeReturnsFullName(): void + public function test_engineer_name_attribute_returns_full_name(): void { $user = User::factory()->create(['first_name' => 'Jane', 'last_name' => 'Doe']); $transfer = Transfer::factory()->create(['engineer_id' => $user]); $this->assertEquals('Jane Doe', $transfer->engineer_name); } - public function testEngineerNameAttributeReturnsNullForNullEngineer(): void + public function test_engineer_name_attribute_returns_null_for_null_engineer(): void { $transfer = Transfer::factory()->create(['engineer_id' => null]); $this->assertNull($transfer->engineer_name);