From 9e58ece8b4c3efd38425c6f4bf0d606f2e10fd25 Mon Sep 17 00:00:00 2001 From: PeterDKC Date: Tue, 4 Oct 2022 16:32:50 -0500 Subject: [PATCH] [WL5] Formatting & Code Sanity Updates --- .php-cs-fixer.dist.php | 3 +- app/Actions/Fortify/CreateNewUser.php | 8 +- app/Actions/Fortify/UpdateUserPassword.php | 4 +- .../Fortify/UpdateUserProfileInformation.php | 20 +-- app/Console/Commands/LegiScanImport.php | 6 +- app/Console/Kernel.php | 3 +- app/Exceptions/Handler.php | 8 +- app/Http/Controllers/Controller.php | 4 +- app/Http/Controllers/Pages/HomeController.php | 14 +- .../Controllers/Pages/StateHomeController.php | 4 +- app/Http/Kernel.php | 18 +-- app/Http/Livewire/BillTable.php | 38 +++--- app/Http/Middleware/Authenticate.php | 2 +- app/Http/Middleware/EncryptCookies.php | 2 +- .../PreventRequestsDuringMaintenance.php | 2 +- .../Middleware/RedirectIfAuthenticated.php | 2 +- app/Http/Middleware/TrustProxies.php | 2 +- app/Http/Middleware/VerifyCsrfToken.php | 2 +- .../Resources/LegiScan/BillDetailResource.php | 52 +------- .../LegiScan/BillVoteDetailsResource.php | 11 +- .../Resources/LegiScan/BillVoteResource.php | 32 ++--- app/Http/Resources/LegiScan/BodyResource.php | 21 +-- .../Resources/LegiScan/SessionResource.php | 31 ++--- app/Models/LegiScan/Bill.php | 36 ++++-- app/Models/LegiScan/BillAmendment.php | 3 +- app/Models/LegiScan/BillAmendmentView.php | 3 +- app/Models/LegiScan/BillCalendar.php | 3 +- app/Models/LegiScan/BillCalendarView.php | 3 +- app/Models/LegiScan/BillHistory.php | 3 +- app/Models/LegiScan/BillHistoryView.php | 3 +- app/Models/LegiScan/BillProgress.php | 3 +- app/Models/LegiScan/BillReason.php | 3 +- app/Models/LegiScan/BillReasonView.php | 3 +- app/Models/LegiScan/BillReferral.php | 3 +- app/Models/LegiScan/BillReferralView.php | 3 +- app/Models/LegiScan/BillSast.php | 3 +- app/Models/LegiScan/BillSastView.php | 3 +- app/Models/LegiScan/BillSponsor.php | 3 +- app/Models/LegiScan/BillSponsorView.php | 3 +- app/Models/LegiScan/BillSubject.php | 3 +- app/Models/LegiScan/BillSubjectView.php | 3 +- app/Models/LegiScan/BillSupplement.php | 3 +- app/Models/LegiScan/BillSupplementView.php | 3 +- app/Models/LegiScan/BillText.php | 3 +- app/Models/LegiScan/BillTextView.php | 3 +- app/Models/LegiScan/BillView.php | 3 +- app/Models/LegiScan/BillVote.php | 9 +- app/Models/LegiScan/BillVoteDetail.php | 4 +- app/Models/LegiScan/BillVoteDetailView.php | 3 +- app/Models/LegiScan/BillVoteView.php | 3 +- app/Models/LegiScan/Body.php | 10 +- app/Models/LegiScan/Committee.php | 3 +- app/Models/LegiScan/EventType.php | 3 +- app/Models/LegiScan/Ignore.php | 3 +- app/Models/LegiScan/MimeType.php | 3 +- app/Models/LegiScan/Monitor.php | 3 +- app/Models/LegiScan/Party.php | 3 +- app/Models/LegiScan/People.php | 3 +- app/Models/LegiScan/Progress.php | 3 +- app/Models/LegiScan/Reason.php | 3 +- app/Models/LegiScan/Role.php | 3 +- app/Models/LegiScan/SastType.php | 3 +- app/Models/LegiScan/Session.php | 3 +- app/Models/LegiScan/Signal.php | 3 +- app/Models/LegiScan/SponsorType.php | 3 +- app/Models/LegiScan/Stance.php | 3 +- app/Models/LegiScan/State.php | 5 + app/Models/LegiScan/Subject.php | 3 +- app/Models/LegiScan/SupplementType.php | 3 +- app/Models/LegiScan/TextType.php | 3 +- app/Models/LegiScan/Type.php | 3 +- app/Models/LegiScan/Variable.php | 3 +- app/Models/LegiScan/Vote.php | 3 +- app/Models/User.php | 9 +- app/Providers/AppServiceProvider.php | 2 - app/Providers/AuthServiceProvider.php | 2 - app/Providers/BroadcastServiceProvider.php | 2 +- app/Providers/EventServiceProvider.php | 3 +- app/Providers/FortifyServiceProvider.php | 13 +- app/Providers/RouteServiceProvider.php | 6 +- app/View/Components/Navbar/Index.php | 1 - app/View/Components/Navbar/Link.php | 19 +-- config/auth.php | 10 +- config/broadcasting.php | 20 +-- config/cache.php | 34 ++--- config/database.php | 90 ++++++------- config/filesystems.php | 30 ++--- config/fortify.php | 6 +- config/hashing.php | 4 +- config/legiscan.php | 2 +- config/logging.php | 50 +++---- config/mail.php | 22 ++-- config/permission.php | 2 +- config/queue.php | 46 +++---- config/sanctum.php | 2 +- config/services.php | 8 +- config/session.php | 2 +- database/factories/LegiScan/BillFactory.php | 18 +-- database/factories/LegiScan/StateFactory.php | 4 +- database/factories/UserFactory.php | 10 +- .../2000_01_01_000000_legiscan_import.php | 7 +- .../2014_10_12_000000_create_users_table.php | 7 +- ...12_100000_create_password_resets_table.php | 7 +- ..._add_two_factor_columns_to_users_table.php | 9 +- ..._08_19_000000_create_failed_jobs_table.php | 7 +- ...01_create_personal_access_tokens_table.php | 7 +- ...8_20_225354_bill_calendar_composite_id.php | 11 +- ...08_20_230557_bill_history_composite_id.php | 11 +- ...8_20_231106_bill_progress_composite_id.php | 11 +- ..._08_20_231332_bill_reason_composite_id.php | 11 +- ...8_20_232251_bill_referral_composite_id.php | 11 +- ...1_004858_bill_vote_detail_composite_id.php | 11 +- .../2022_09_18_024058_legiscan_bill_table.php | 11 +- ..._09_18_162851_create_permission_tables.php | 31 +++-- .../2022_10_03_200810_create_states_table.php | 7 +- .../seeders/ImportLegiScanSchemaSeeder.php | 6 +- phpmd.xml | 79 ++++++++++++ resources/views/livewire/bill-table.blade.php | 4 +- resources/views/pages/home/index.blade.php | 12 +- routes/api.php | 122 ++++++++---------- routes/web.php | 2 +- tests/CreatesApplication.php | 2 +- 122 files changed, 663 insertions(+), 628 deletions(-) create mode 100644 phpmd.xml diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 71b79dc..8467c2e 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -47,8 +47,7 @@ 'no_short_bool_cast' => true, 'no_singleline_whitespace_before_semicolons' => true, 'no_spaces_around_offset' => ['positions' => ['inside']], - 'no_trailing_comma_in_list_call' => true, - 'no_trailing_comma_in_singleline_array' => true, + 'no_trailing_comma_in_singleline' => true, 'no_unneeded_control_parentheses' => ['statements' => ['break', 'clone', 'continue', 'echo_print', 'return', 'switch_case', 'yield']], // https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/4159 // 'no_unused_imports' => true, diff --git a/app/Actions/Fortify/CreateNewUser.php b/app/Actions/Fortify/CreateNewUser.php index cc593f3..5a553bd 100644 --- a/app/Actions/Fortify/CreateNewUser.php +++ b/app/Actions/Fortify/CreateNewUser.php @@ -3,9 +3,9 @@ namespace App\Actions\Fortify; use App\Models\User; +use Illuminate\Validation\Rule; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Validator; -use Illuminate\Validation\Rule; use Laravel\Fortify\Contracts\CreatesNewUsers; class CreateNewUser implements CreatesNewUsers @@ -21,7 +21,7 @@ class CreateNewUser implements CreatesNewUsers public function create(array $input) { Validator::make($input, [ - 'name' => ['required', 'string', 'max:255'], + 'name' => ['required', 'string', 'max:255'], 'email' => [ 'required', 'string', @@ -33,8 +33,8 @@ public function create(array $input) ])->validate(); return User::create([ - 'name' => $input['name'], - 'email' => $input['email'], + 'name' => $input['name'], + 'email' => $input['email'], 'password' => Hash::make($input['password']), ]); } diff --git a/app/Actions/Fortify/UpdateUserPassword.php b/app/Actions/Fortify/UpdateUserPassword.php index 690f324..f31976d 100644 --- a/app/Actions/Fortify/UpdateUserPassword.php +++ b/app/Actions/Fortify/UpdateUserPassword.php @@ -21,9 +21,9 @@ public function update($user, array $input) { Validator::make($input, [ 'current_password' => ['required', 'string'], - 'password' => $this->passwordRules(), + 'password' => $this->passwordRules(), ])->after(function ($validator) use ($user, $input) { - if (! isset($input['current_password']) || ! Hash::check($input['current_password'], $user->password)) { + if (!isset($input['current_password']) || !Hash::check($input['current_password'], $user->password)) { $validator->errors()->add('current_password', __('The provided password does not match your current password.')); } })->validateWithBag('updatePassword'); diff --git a/app/Actions/Fortify/UpdateUserProfileInformation.php b/app/Actions/Fortify/UpdateUserProfileInformation.php index 95e84ab..7163d3c 100644 --- a/app/Actions/Fortify/UpdateUserProfileInformation.php +++ b/app/Actions/Fortify/UpdateUserProfileInformation.php @@ -2,9 +2,9 @@ namespace App\Actions\Fortify; -use Illuminate\Contracts\Auth\MustVerifyEmail; -use Illuminate\Support\Facades\Validator; use Illuminate\Validation\Rule; +use Illuminate\Support\Facades\Validator; +use Illuminate\Contracts\Auth\MustVerifyEmail; use Laravel\Fortify\Contracts\UpdatesUserProfileInformation; class UpdateUserProfileInformation implements UpdatesUserProfileInformation @@ -33,12 +33,14 @@ public function update($user, array $input) if ($input['email'] !== $user->email && $user instanceof MustVerifyEmail) { $this->updateVerifiedUser($user, $input); - } else { - $user->forceFill([ - 'name' => $input['name'], - 'email' => $input['email'], - ])->save(); + + return; } + + $user->forceFill([ + 'name' => $input['name'], + 'email' => $input['email'], + ])->save(); } /** @@ -51,8 +53,8 @@ public function update($user, array $input) protected function updateVerifiedUser($user, array $input) { $user->forceFill([ - 'name' => $input['name'], - 'email' => $input['email'], + 'name' => $input['name'], + 'email' => $input['email'], 'email_verified_at' => null, ])->save(); diff --git a/app/Console/Commands/LegiScanImport.php b/app/Console/Commands/LegiScanImport.php index 1ac9dad..17fc6f1 100644 --- a/app/Console/Commands/LegiScanImport.php +++ b/app/Console/Commands/LegiScanImport.php @@ -50,7 +50,7 @@ protected function translateStates(): static 'name' => $state->state_name, 'abbreviation' => $state->state_abbr, 'biennium' => $state->biennium, - 'carry_over' => $state->carry_over, + 'carry_over' => $state->carry_over, 'capitol' => $state->capitol, 'latitude' => $state->latitude, 'longitude' => $state->longitude, @@ -62,7 +62,7 @@ protected function translateStates(): static $progress->finish(); - $this->info("\n".$this->separator); + $this->info("\n" . $this->separator); return $this; } @@ -89,7 +89,7 @@ protected function importLegiscanData(): static ); $this->info('Importing LegiScan data. This may take a minute.'); - + exec($command); Log::info('LegiScan import completed'); diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index d8bc1d2..c5f1232 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -12,6 +12,7 @@ class Kernel extends ConsoleKernel * * @param \Illuminate\Console\Scheduling\Schedule $schedule * @return void + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ protected function schedule(Schedule $schedule) { @@ -25,7 +26,7 @@ protected function schedule(Schedule $schedule) */ protected function commands() { - $this->load(__DIR__.'/Commands'); + $this->load(__DIR__ . '/Commands'); require base_path('routes/console.php'); } diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 82a37e4..62dfa19 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -2,8 +2,8 @@ namespace App\Exceptions; -use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; use Throwable; +use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; class Handler extends ExceptionHandler { @@ -13,7 +13,7 @@ class Handler extends ExceptionHandler * @var array, \Psr\Log\LogLevel::*> */ protected $levels = [ - // + ]; /** @@ -22,7 +22,7 @@ class Handler extends ExceptionHandler * @var array> */ protected $dontReport = [ - // + ]; /** @@ -40,11 +40,11 @@ class Handler extends ExceptionHandler * Register the exception handling callbacks for the application. * * @return void + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function register() { $this->reportable(function (Throwable $e) { - // }); } } diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index a0a2a8a..03e02a2 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -2,10 +2,10 @@ namespace App\Http\Controllers; -use Illuminate\Foundation\Auth\Access\AuthorizesRequests; use Illuminate\Foundation\Bus\DispatchesJobs; -use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Routing\Controller as BaseController; +use Illuminate\Foundation\Validation\ValidatesRequests; +use Illuminate\Foundation\Auth\Access\AuthorizesRequests; class Controller extends BaseController { diff --git a/app/Http/Controllers/Pages/HomeController.php b/app/Http/Controllers/Pages/HomeController.php index 8964bfd..f1f5fc4 100644 --- a/app/Http/Controllers/Pages/HomeController.php +++ b/app/Http/Controllers/Pages/HomeController.php @@ -2,18 +2,20 @@ namespace App\Http\Controllers\Pages; -use App\Http\Controllers\Controller; use App\Models\LegiScan\State; +use App\Http\Controllers\Controller; class HomeController extends Controller { public function index() { - $states = State::whereNotIn('state_abbr', ['DC', 'US'])->get(); - - $dc = State::where('state_abbr', 'DC')->first(); - $us = State::where('state_abbr', 'US')->first(); + $states = State::nonNational()->get(); + $districtOfColumbia = State::where('abbreviation', 'DC')->first(); + $unitedStates = State::where('abbreviation', 'US')->first(); - return view('pages.home.index', compact('states', 'dc', 'us')); + return view('pages.home.index') + ->withStates($states) + ->withDistrictOfColumbia($districtOfColumbia) + ->withUnitedStates($unitedStates); } } diff --git a/app/Http/Controllers/Pages/StateHomeController.php b/app/Http/Controllers/Pages/StateHomeController.php index d984432..81e5396 100644 --- a/app/Http/Controllers/Pages/StateHomeController.php +++ b/app/Http/Controllers/Pages/StateHomeController.php @@ -2,10 +2,10 @@ namespace App\Http\Controllers\Pages; -use App\Http\Controllers\Controller; +use Illuminate\Http\Request; use App\Models\LegiScan\Bill; use App\Models\LegiScan\State; -use Illuminate\Http\Request; +use App\Http\Controllers\Controller; class StateHomeController extends Controller { diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index bd3139f..4beb89b 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -53,15 +53,15 @@ class Kernel extends HttpKernel * @var array */ protected $routeMiddleware = [ - 'auth' => \App\Http\Middleware\Authenticate::class, - 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, - 'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class, - 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, - 'can' => \Illuminate\Auth\Middleware\Authorize::class, - 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, + 'auth' => \App\Http\Middleware\Authenticate::class, + 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, + 'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class, + 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, + 'can' => \Illuminate\Auth\Middleware\Authorize::class, + 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, - 'signed' => \App\Http\Middleware\ValidateSignature::class, - 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, - 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, + 'signed' => \App\Http\Middleware\ValidateSignature::class, + 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, + 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, ]; } diff --git a/app/Http/Livewire/BillTable.php b/app/Http/Livewire/BillTable.php index 6a947bc..5902c99 100644 --- a/app/Http/Livewire/BillTable.php +++ b/app/Http/Livewire/BillTable.php @@ -2,9 +2,9 @@ namespace App\Http\Livewire; +use Livewire\Component; use App\Models\LegiScan\Bill; use App\Traits\Livewire\WithPerPagePagination; -use Livewire\Component; class BillTable extends Component { @@ -14,7 +14,8 @@ class BillTable extends Component 'search' => ['initial' => null, 'as' => 'q'], ]; - public $state_id; + public $stateId; + public $search = null; public function updatedSearch() @@ -25,36 +26,37 @@ public function updatedSearch() public function query() { return Bill::query() - ->when($this->state_id, - fn($query) => $query->where('state_id', $this->state_id) - ) - ; + ->when( + $this->stateId, + fn ($query) => $query->where('state_id', $this->stateId) + ); } + public function applyFilters($query) { return $query - ->when($this->search, - fn($query) => $query + ->when( + $this->search, + fn ($query) => $query ->where( - fn($subquery) => $subquery - ->where('bill_number', 'like', '%'.$this->search.'%') - ->orWhere('title', 'like', '%'.$this->search.'%') - ->orWhere('description', 'like', '%'.$this->search.'%') - ) - ) - ; + fn ($subquery) => $subquery + ->where('bill_number', 'like', '%' . $this->search . '%') + ->orWhere('title', 'like', '%' . $this->search . '%') + ->orWhere('description', 'like', '%' . $this->search . '%') + ) + ); } public function render() { - $bill_count = $this->query()->count(); - $bills = $this->applyPagination( + $billCount = $this->query()->count(); + $bills = $this->applyPagination( $this->applyFilters($this->query()->orderByDesc('status_date')) ); $has_filters = $this->hasFilters(); - return view('livewire.bill-table', compact('bills', 'bill_count', 'has_filters')); + return view('livewire.bill-table', compact('bills', 'billCount', 'has_filters')); } public function hasFilters() diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index 704089a..de3dbd4 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -14,7 +14,7 @@ class Authenticate extends Middleware */ protected function redirectTo($request) { - if (! $request->expectsJson()) { + if (!$request->expectsJson()) { return route('login'); } } diff --git a/app/Http/Middleware/EncryptCookies.php b/app/Http/Middleware/EncryptCookies.php index 867695b..c36aa12 100644 --- a/app/Http/Middleware/EncryptCookies.php +++ b/app/Http/Middleware/EncryptCookies.php @@ -12,6 +12,6 @@ class EncryptCookies extends Middleware * @var array */ protected $except = [ - // + ]; } diff --git a/app/Http/Middleware/PreventRequestsDuringMaintenance.php b/app/Http/Middleware/PreventRequestsDuringMaintenance.php index 74cbd9a..e09261b 100644 --- a/app/Http/Middleware/PreventRequestsDuringMaintenance.php +++ b/app/Http/Middleware/PreventRequestsDuringMaintenance.php @@ -12,6 +12,6 @@ class PreventRequestsDuringMaintenance extends Middleware * @var array */ protected $except = [ - // + ]; } diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index a2813a0..32e3e71 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -2,10 +2,10 @@ namespace App\Http\Middleware; -use App\Providers\RouteServiceProvider; use Closure; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; +use App\Providers\RouteServiceProvider; class RedirectIfAuthenticated { diff --git a/app/Http/Middleware/TrustProxies.php b/app/Http/Middleware/TrustProxies.php index 3391630..f6e9c2d 100644 --- a/app/Http/Middleware/TrustProxies.php +++ b/app/Http/Middleware/TrustProxies.php @@ -2,8 +2,8 @@ namespace App\Http\Middleware; -use Illuminate\Http\Middleware\TrustProxies as Middleware; use Illuminate\Http\Request; +use Illuminate\Http\Middleware\TrustProxies as Middleware; class TrustProxies extends Middleware { diff --git a/app/Http/Middleware/VerifyCsrfToken.php b/app/Http/Middleware/VerifyCsrfToken.php index 9e86521..13e2270 100644 --- a/app/Http/Middleware/VerifyCsrfToken.php +++ b/app/Http/Middleware/VerifyCsrfToken.php @@ -12,6 +12,6 @@ class VerifyCsrfToken extends Middleware * @var array */ protected $except = [ - // + ]; } diff --git a/app/Http/Resources/LegiScan/BillDetailResource.php b/app/Http/Resources/LegiScan/BillDetailResource.php index 7e98348..eb4474b 100644 --- a/app/Http/Resources/LegiScan/BillDetailResource.php +++ b/app/Http/Resources/LegiScan/BillDetailResource.php @@ -2,66 +2,18 @@ namespace App\Http\Resources\LegiScan; -use App\Models\LegiScan\Session; use App\Models\LegiScan\State; +use App\Models\LegiScan\Session; use Illuminate\Http\Resources\Json\JsonResource; class BillDetailResource extends JsonResource { /** - * Transform the resource into an array. - * - * @param \Illuminate\Http\Request $request - * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toArray($request) { - // return parent::toArray($request); - return [ - - // // Primary metadata - // 'bill_number' => $this->bill_number, - // 'bill_id' => $this->bill_id, - // 'bill_type' => $this->bill_type, - // 'updated' => $this->updated, - // 'created' => $this->created, - - // // Where - // 'state' => $this->state, - // 'session' => new SessionResource($this->session), - // 'body' => new BodyResource($this->body), - // 'current_body' => new BodyResource($this->current_body), - // 'pending_committee' => $this->pending_committee, - - // // Situation - // 'status_id' => $this->status_id, // 'status' => $this->status, - // 'status_date' => $this->status_date, - - // // - - - // // Content - // 'title' => $this->title, - // 'description' => $this->description, - - // // Secondary metadata - // 'state_url' => $this->state_url, - // 'legiscan_url' => $this->legiscan_url, - // 'change_hash' => $this->change_hash, - - // 'ammendments' => JsonResource::collection($this->ammendments), - // 'calendar_dates' => JsonResource::collection($this->calendar_dates), - // 'history_items' => $this->history_items, - // 'progress' => $this->progress, - // 'reasons' => $this->reasons, - // 'referrals' => $this->referrals, - // // 'sast_items' => $this->sast_items, - // // 'sponsors' => $this->sponsors, - // // 'subjects' => $this->subjects, - // // 'supplements' => $this->supplements, - // // 'texts' => $this->texts, - // 'views' => $this->views, 'votes' => BillVoteResource::collection($this->votes), ]; } diff --git a/app/Http/Resources/LegiScan/BillVoteDetailsResource.php b/app/Http/Resources/LegiScan/BillVoteDetailsResource.php index 37ee452..e4cd96f 100644 --- a/app/Http/Resources/LegiScan/BillVoteDetailsResource.php +++ b/app/Http/Resources/LegiScan/BillVoteDetailsResource.php @@ -7,19 +7,14 @@ class BillVoteDetailsResource extends JsonResource { /** - * Transform the resource into an array. - * - * @param \Illuminate\Http\Request $request - * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toArray($request) { - // return parent::toArray($request); - return [ 'roll_call_id' => $this->roll_call_id, - 'person' => $this->person, - 'vote' => $this->vote, + 'person' => $this->person, + 'vote' => $this->vote, ]; } } diff --git a/app/Http/Resources/LegiScan/BillVoteResource.php b/app/Http/Resources/LegiScan/BillVoteResource.php index f1dc018..7502b32 100644 --- a/app/Http/Resources/LegiScan/BillVoteResource.php +++ b/app/Http/Resources/LegiScan/BillVoteResource.php @@ -7,31 +7,27 @@ class BillVoteResource extends JsonResource { /** - * Transform the resource into an array. - * - * @param \Illuminate\Http\Request $request - * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toArray($request) { - // return parent::toArray($request); return [ - 'roll_call_id' => $this->roll_call_id, - 'bill_id' => $this->bill_id, + 'roll_call_id' => $this->roll_call_id, + 'bill_id' => $this->bill_id, 'roll_call_body' => new BodyResource($this->roll_call_body), 'roll_call_date' => $this->roll_call_date, 'roll_call_desc' => $this->roll_call_desc, - 'yea' => $this->yea, - 'nea' => $this->nea, - 'nv' => $this->nv, - 'absent' => $this->absent, - 'total' => $this->total, - 'passed' => $this->passed, - 'legiscan_url' => $this->legiscan_url, - 'state_url' => $this->state_url, - 'updated' => $this->updated, - 'created' => $this->created, - 'details' => BillVoteDetailsResource::collection($this->details), + 'yea' => $this->yea, + 'nea' => $this->nea, + 'nv' => $this->nv, + 'absent' => $this->absent, + 'total' => $this->total, + 'passed' => $this->passed, + 'legiscan_url' => $this->legiscan_url, + 'state_url' => $this->state_url, + 'updated' => $this->updated, + 'created' => $this->created, + 'details' => BillVoteDetailsResource::collection($this->details), ]; } } diff --git a/app/Http/Resources/LegiScan/BodyResource.php b/app/Http/Resources/LegiScan/BodyResource.php index 2141646..b14c8a9 100644 --- a/app/Http/Resources/LegiScan/BodyResource.php +++ b/app/Http/Resources/LegiScan/BodyResource.php @@ -7,26 +7,19 @@ class BodyResource extends JsonResource { /** - * Transform the resource into an array. - * - * @param \Illuminate\Http\Request $request - * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toArray($request) { - // return parent::toArray($request); - return [ - - 'body_id' => $this->body_id, - 'state' => $this->state, - 'role' => $this->role, - 'body_abbr' => $this->body_abbr, - 'body_short' => $this->body_short, - 'body_name' => $this->body_name, + 'body_id' => $this->body_id, + 'state' => $this->state, + 'role' => $this->role, + 'body_abbr' => $this->body_abbr, + 'body_short' => $this->body_short, + 'body_name' => $this->body_name, 'body_role_abbr' => $this->body_role_abbr, 'body_role_name' => $this->body_role_name, - ]; } } diff --git a/app/Http/Resources/LegiScan/SessionResource.php b/app/Http/Resources/LegiScan/SessionResource.php index 2d4f84c..3bed8a9 100644 --- a/app/Http/Resources/LegiScan/SessionResource.php +++ b/app/Http/Resources/LegiScan/SessionResource.php @@ -7,30 +7,25 @@ class SessionResource extends JsonResource { /** - * Transform the resource into an array. - * - * @param \Illuminate\Http\Request $request - * @return array|\Illuminate\Contracts\Support\Arrayable|\JsonSerializable + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function toArray($request) { - // return parent::toArray($request); - return [ - 'session_id' => $this->session_id, - 'state' => $this->state, - 'year_start' => $this->year_start, - 'year_end' => $this->year_end, - 'prefile' => $this->prefile, - 'sine_die' => $this->sine_die, - 'prior' => $this->prior, - 'special' => $this->special, - 'session_name' => $this->session_name, + 'session_id' => $this->session_id, + 'state' => $this->state, + 'year_start' => $this->year_start, + 'year_end' => $this->year_end, + 'prefile' => $this->prefile, + 'sine_die' => $this->sine_die, + 'prior' => $this->prior, + 'special' => $this->special, + 'session_name' => $this->session_name, 'session_title' => $this->session_title, - 'session_tag' => $this->session_tag, - 'import_date' => $this->import_date, - 'import_hash' => $this->import_hash, + 'session_tag' => $this->session_tag, + 'import_date' => $this->import_date, + 'import_hash' => $this->import_hash, ]; } diff --git a/app/Models/LegiScan/Bill.php b/app/Models/LegiScan/Bill.php index 6d7429d..ffd8c14 100644 --- a/app/Models/LegiScan/Bill.php +++ b/app/Models/LegiScan/Bill.php @@ -9,7 +9,7 @@ class Bill extends Model { use HasFactory; - #region Variables + //region Variables protected $table = 'ls_bill'; @@ -41,36 +41,42 @@ class Bill extends Model 'change_hash', ]; - #endregion + //endregion - #region Relationships + //region Relationships // Foreign key references public function state() { return $this->belongsTo(State::class, 'state_id'); } + public function session() { return $this->belongsTo(Session::class, 'session_id'); } + public function body() { return $this->belongsTo(Body::class, 'body_id'); } - public function current_body() + + public function currentBody() { return $this->belongsTo(Body::class, 'current_body_id'); } - public function bill_type() + + public function billType() { return $this->belongsTo(Type::class, 'bill_type_id'); } + public function status() { return $this->belongsTo(Progress::class, 'status_id'); } - public function pending_committee() + + public function pendingCommittee() { return $this->belongsTo(Committee::class, 'pending_committee_id'); } @@ -80,50 +86,62 @@ public function ammendments() { return $this->hasMany(BillAmendment::class, 'bill_id'); } - public function calendar_dates() + + public function calendarDates() { return $this->hasMany(BillCalendar::class, 'bill_id'); } - public function history_items() + + public function historyItems() { return $this->hasMany(BillHistory::class, 'bill_id'); } + public function progress() { return $this->hasMany(BillProgress::class, 'bill_id'); } + public function reasons() { return $this->hasMany(BillReason::class, 'bill_id'); } + public function referrals() { return $this->hasMany(BillReferral::class, 'bill_id'); } - public function sast_items() + + public function sastItems() { return $this->hasMany(BillSast::class, 'bill_id'); } + public function sponsors() { return $this->hasMany(BillSponsor::class, 'bill_id'); } + public function subjects() { return $this->hasMany(BillSubject::class, 'bill_id'); } + public function supplements() { return $this->hasMany(BillSupplement::class, 'bill_id'); } + public function texts() { return $this->hasMany(BillText::class, 'bill_text'); } + public function views() { return $this->hasMany(BillView::class, 'bill_id'); } + public function votes() { return $this->hasMany(BillVote::class, 'bill_id'); diff --git a/app/Models/LegiScan/BillAmendment.php b/app/Models/LegiScan/BillAmendment.php index bfa4cc4..aafb5e9 100644 --- a/app/Models/LegiScan/BillAmendment.php +++ b/app/Models/LegiScan/BillAmendment.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class BillAmendment extends Model { use HasFactory; protected $table = 'ls_bill_amendment'; + protected $primaryKey = 'amendment_id'; } diff --git a/app/Models/LegiScan/BillAmendmentView.php b/app/Models/LegiScan/BillAmendmentView.php index a3f2766..2743314 100644 --- a/app/Models/LegiScan/BillAmendmentView.php +++ b/app/Models/LegiScan/BillAmendmentView.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class BillAmendmentView extends Model { use HasFactory; protected $table = 'lsv_bill_amendment'; + protected $primaryKey = 'amendment_id'; } diff --git a/app/Models/LegiScan/BillCalendar.php b/app/Models/LegiScan/BillCalendar.php index 90241a0..157c90d 100644 --- a/app/Models/LegiScan/BillCalendar.php +++ b/app/Models/LegiScan/BillCalendar.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class BillCalendar extends Model { use HasFactory; protected $table = 'ls_bill_calendar'; + protected $primaryKey = 'composite_id'; } diff --git a/app/Models/LegiScan/BillCalendarView.php b/app/Models/LegiScan/BillCalendarView.php index 38b0da3..7ed93d4 100644 --- a/app/Models/LegiScan/BillCalendarView.php +++ b/app/Models/LegiScan/BillCalendarView.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class BillCalendarView extends Model { use HasFactory; protected $table = 'lsv_bill_calendar'; + protected $primaryKey = 'composite_id'; // Requires underlying view to be rewritten. } diff --git a/app/Models/LegiScan/BillHistory.php b/app/Models/LegiScan/BillHistory.php index e3840df..d7c1739 100644 --- a/app/Models/LegiScan/BillHistory.php +++ b/app/Models/LegiScan/BillHistory.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class BillHistory extends Model { use HasFactory; protected $table = 'ls_bill_history'; + protected $primaryKey = 'composite_id'; } diff --git a/app/Models/LegiScan/BillHistoryView.php b/app/Models/LegiScan/BillHistoryView.php index 30a407e..3c51cec 100644 --- a/app/Models/LegiScan/BillHistoryView.php +++ b/app/Models/LegiScan/BillHistoryView.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class BillHistoryView extends Model { use HasFactory; protected $table = 'lsv_bill_history'; + protected $primaryKey = 'composite_id'; // Requires underlying view to be rewritten. } diff --git a/app/Models/LegiScan/BillProgress.php b/app/Models/LegiScan/BillProgress.php index edc9bb5..678e674 100644 --- a/app/Models/LegiScan/BillProgress.php +++ b/app/Models/LegiScan/BillProgress.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class BillProgress extends Model { use HasFactory; protected $table = 'ls_bill_progress'; + protected $primaryKey = 'composite_id'; } diff --git a/app/Models/LegiScan/BillReason.php b/app/Models/LegiScan/BillReason.php index 3850b82..c19cc60 100644 --- a/app/Models/LegiScan/BillReason.php +++ b/app/Models/LegiScan/BillReason.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class BillReason extends Model { use HasFactory; protected $table = 'ls_bill_reason'; + protected $primaryKey = 'composite_id'; } diff --git a/app/Models/LegiScan/BillReasonView.php b/app/Models/LegiScan/BillReasonView.php index d4e0135..2a962f0 100644 --- a/app/Models/LegiScan/BillReasonView.php +++ b/app/Models/LegiScan/BillReasonView.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class BillReasonView extends Model { use HasFactory; protected $table = 'lsv_bill_reason'; + protected $primaryKey = 'composite_id'; // Requires underlying view to be rewritten. } diff --git a/app/Models/LegiScan/BillReferral.php b/app/Models/LegiScan/BillReferral.php index 562769e..1b0878d 100644 --- a/app/Models/LegiScan/BillReferral.php +++ b/app/Models/LegiScan/BillReferral.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class BillReferral extends Model { use HasFactory; protected $table = 'ls_bill_referral'; + protected $primaryKey = 'composite_id'; } diff --git a/app/Models/LegiScan/BillReferralView.php b/app/Models/LegiScan/BillReferralView.php index d90ba1d..dd95840 100644 --- a/app/Models/LegiScan/BillReferralView.php +++ b/app/Models/LegiScan/BillReferralView.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class BillReferralView extends Model { use HasFactory; protected $table = 'lsv_bill_referral'; + protected $primaryKey = ''; // bill_id, referral_step } diff --git a/app/Models/LegiScan/BillSast.php b/app/Models/LegiScan/BillSast.php index 0620f05..6bad0d1 100644 --- a/app/Models/LegiScan/BillSast.php +++ b/app/Models/LegiScan/BillSast.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class BillSast extends Model { use HasFactory; protected $table = ''; + protected $primaryKey = ''; } diff --git a/app/Models/LegiScan/BillSastView.php b/app/Models/LegiScan/BillSastView.php index 90ac39b..ee53f76 100644 --- a/app/Models/LegiScan/BillSastView.php +++ b/app/Models/LegiScan/BillSastView.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class BillSastView extends Model { use HasFactory; protected $table = ''; + protected $primaryKey = ''; } diff --git a/app/Models/LegiScan/BillSponsor.php b/app/Models/LegiScan/BillSponsor.php index c746166..401d5a9 100644 --- a/app/Models/LegiScan/BillSponsor.php +++ b/app/Models/LegiScan/BillSponsor.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class BillSponsor extends Model { use HasFactory; protected $table = ''; + protected $primaryKey = ''; } diff --git a/app/Models/LegiScan/BillSponsorView.php b/app/Models/LegiScan/BillSponsorView.php index 2a11435..b55f49f 100644 --- a/app/Models/LegiScan/BillSponsorView.php +++ b/app/Models/LegiScan/BillSponsorView.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class BillSponsorView extends Model { use HasFactory; protected $table = ''; + protected $primaryKey = ''; } diff --git a/app/Models/LegiScan/BillSubject.php b/app/Models/LegiScan/BillSubject.php index 55d4951..641635c 100644 --- a/app/Models/LegiScan/BillSubject.php +++ b/app/Models/LegiScan/BillSubject.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class BillSubject extends Model { use HasFactory; protected $table = ''; + protected $primaryKey = ''; } diff --git a/app/Models/LegiScan/BillSubjectView.php b/app/Models/LegiScan/BillSubjectView.php index 744d132..a78b6a7 100644 --- a/app/Models/LegiScan/BillSubjectView.php +++ b/app/Models/LegiScan/BillSubjectView.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class BillSubjectView extends Model { use HasFactory; protected $table = ''; + protected $primaryKey = ''; } diff --git a/app/Models/LegiScan/BillSupplement.php b/app/Models/LegiScan/BillSupplement.php index 95af24e..0bd381c 100644 --- a/app/Models/LegiScan/BillSupplement.php +++ b/app/Models/LegiScan/BillSupplement.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class BillSupplement extends Model { use HasFactory; protected $table = ''; + protected $primaryKey = ''; } diff --git a/app/Models/LegiScan/BillSupplementView.php b/app/Models/LegiScan/BillSupplementView.php index 6be7547..3cbbf06 100644 --- a/app/Models/LegiScan/BillSupplementView.php +++ b/app/Models/LegiScan/BillSupplementView.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class BillSupplementView extends Model { use HasFactory; protected $table = ''; + protected $primaryKey = ''; } diff --git a/app/Models/LegiScan/BillText.php b/app/Models/LegiScan/BillText.php index 6c6231f..202c7bc 100644 --- a/app/Models/LegiScan/BillText.php +++ b/app/Models/LegiScan/BillText.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class BillText extends Model { use HasFactory; protected $table = ''; + protected $primaryKey = ''; } diff --git a/app/Models/LegiScan/BillTextView.php b/app/Models/LegiScan/BillTextView.php index 681b6d8..15ddbe8 100644 --- a/app/Models/LegiScan/BillTextView.php +++ b/app/Models/LegiScan/BillTextView.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class BillTextView extends Model { use HasFactory; protected $table = ''; + protected $primaryKey = ''; } diff --git a/app/Models/LegiScan/BillView.php b/app/Models/LegiScan/BillView.php index e5a65a0..5c58a11 100644 --- a/app/Models/LegiScan/BillView.php +++ b/app/Models/LegiScan/BillView.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class BillView extends Model { use HasFactory; protected $table = 'lsv_bill'; + protected $primaryKey = 'bill_id'; } diff --git a/app/Models/LegiScan/BillVote.php b/app/Models/LegiScan/BillVote.php index 1ac5d9b..c312ab2 100644 --- a/app/Models/LegiScan/BillVote.php +++ b/app/Models/LegiScan/BillVote.php @@ -2,21 +2,24 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class BillVote extends Model { use HasFactory; protected $table = 'ls_bill_vote'; + protected $primaryKey = 'roll_call_id'; - public function roll_call_body() { + public function rollCallBody() + { return $this->belongsTo(Body::class, 'roll_call_body_id'); } - public function details() { + public function details() + { return $this->hasMany(BillVoteDetail::class, 'roll_call_id'); } } diff --git a/app/Models/LegiScan/BillVoteDetail.php b/app/Models/LegiScan/BillVoteDetail.php index e3e3c1e..e7c612b 100644 --- a/app/Models/LegiScan/BillVoteDetail.php +++ b/app/Models/LegiScan/BillVoteDetail.php @@ -2,20 +2,22 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class BillVoteDetail extends Model { use HasFactory; protected $table = 'ls_bill_vote_detail'; + protected $primaryKey = 'composite_id'; public function person() { return $this->belongsTo(People::class, 'people_id'); } + public function vote() { return $this->belongsTo(Vote::class, 'vote_id'); diff --git a/app/Models/LegiScan/BillVoteDetailView.php b/app/Models/LegiScan/BillVoteDetailView.php index f318a10..2563b8e 100644 --- a/app/Models/LegiScan/BillVoteDetailView.php +++ b/app/Models/LegiScan/BillVoteDetailView.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class BillVoteDetailView extends Model { use HasFactory; protected $table = 'lsv_bill_vote_detail'; + protected $primaryKey = 'composite_id'; } diff --git a/app/Models/LegiScan/BillVoteView.php b/app/Models/LegiScan/BillVoteView.php index cfe2335..ea133a7 100644 --- a/app/Models/LegiScan/BillVoteView.php +++ b/app/Models/LegiScan/BillVoteView.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class BillVoteView extends Model { use HasFactory; protected $table = 'ls_bill_vote'; + protected $primaryKey = 'roll_call_id'; } diff --git a/app/Models/LegiScan/Body.php b/app/Models/LegiScan/Body.php index ad015ab..644708a 100644 --- a/app/Models/LegiScan/Body.php +++ b/app/Models/LegiScan/Body.php @@ -2,20 +2,24 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class Body extends Model { use HasFactory; protected $table = 'ls_body'; + protected $primaryKey = 'body_id'; - public function state() { + public function state() + { return $this->belongsTo(State::class, 'state_id'); } - public function role() { + + public function role() + { return $this->belongsTo(Role::class, 'role_id'); } } diff --git a/app/Models/LegiScan/Committee.php b/app/Models/LegiScan/Committee.php index 85110af..6e26bfe 100644 --- a/app/Models/LegiScan/Committee.php +++ b/app/Models/LegiScan/Committee.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class Committee extends Model { use HasFactory; protected $table = 'ls_committee'; + protected $primaryKey = 'committee_id'; } diff --git a/app/Models/LegiScan/EventType.php b/app/Models/LegiScan/EventType.php index f86d87b..51df71d 100644 --- a/app/Models/LegiScan/EventType.php +++ b/app/Models/LegiScan/EventType.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class EventType extends Model { use HasFactory; protected $table = 'ls_event_type'; + protected $primaryKey = 'event_type_id'; } diff --git a/app/Models/LegiScan/Ignore.php b/app/Models/LegiScan/Ignore.php index 06b334b..54ac940 100644 --- a/app/Models/LegiScan/Ignore.php +++ b/app/Models/LegiScan/Ignore.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class Ignore extends Model { use HasFactory; protected $table = 'ls_ignore'; + protected $primaryKey = 'bill_id'; } diff --git a/app/Models/LegiScan/MimeType.php b/app/Models/LegiScan/MimeType.php index 20ef373..78bbf30 100644 --- a/app/Models/LegiScan/MimeType.php +++ b/app/Models/LegiScan/MimeType.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class MimeType extends Model { use HasFactory; protected $table = 'ls_mime_type'; + protected $primaryKey = 'mime_id'; } diff --git a/app/Models/LegiScan/Monitor.php b/app/Models/LegiScan/Monitor.php index bc09791..faf048a 100644 --- a/app/Models/LegiScan/Monitor.php +++ b/app/Models/LegiScan/Monitor.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class Monitor extends Model { use HasFactory; protected $table = 'ls_monitor'; + protected $primaryKey = 'bill_id'; } diff --git a/app/Models/LegiScan/Party.php b/app/Models/LegiScan/Party.php index 8a14d9e..f50c452 100644 --- a/app/Models/LegiScan/Party.php +++ b/app/Models/LegiScan/Party.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class Party extends Model { use HasFactory; protected $table = 'ls_party'; + protected $primaryKey = 'party_id'; } diff --git a/app/Models/LegiScan/People.php b/app/Models/LegiScan/People.php index 216fbe5..7262f9f 100644 --- a/app/Models/LegiScan/People.php +++ b/app/Models/LegiScan/People.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class People extends Model { use HasFactory; protected $table = 'ls_people'; + protected $primaryKey = 'people_id'; } diff --git a/app/Models/LegiScan/Progress.php b/app/Models/LegiScan/Progress.php index 4751758..d0d48af 100644 --- a/app/Models/LegiScan/Progress.php +++ b/app/Models/LegiScan/Progress.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class Progress extends Model { use HasFactory; protected $table = 'ls_progress'; + protected $primaryKey = 'progress_event_id'; } diff --git a/app/Models/LegiScan/Reason.php b/app/Models/LegiScan/Reason.php index b4479df..9a54024 100644 --- a/app/Models/LegiScan/Reason.php +++ b/app/Models/LegiScan/Reason.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class Reason extends Model { use HasFactory; protected $table = 'ls_reason'; + protected $primaryKey = 'reason_id'; } diff --git a/app/Models/LegiScan/Role.php b/app/Models/LegiScan/Role.php index 0e40926..b769375 100644 --- a/app/Models/LegiScan/Role.php +++ b/app/Models/LegiScan/Role.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class Role extends Model { use HasFactory; protected $table = 'ls_role'; + protected $primaryKey = 'role_id'; } diff --git a/app/Models/LegiScan/SastType.php b/app/Models/LegiScan/SastType.php index 8abc982..ff3ad6c 100644 --- a/app/Models/LegiScan/SastType.php +++ b/app/Models/LegiScan/SastType.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class SastType extends Model { use HasFactory; protected $table = 'ls_sast_type'; + protected $primaryKey = 'sast_id'; } diff --git a/app/Models/LegiScan/Session.php b/app/Models/LegiScan/Session.php index a05fd08..f64e817 100644 --- a/app/Models/LegiScan/Session.php +++ b/app/Models/LegiScan/Session.php @@ -2,14 +2,15 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class Session extends Model { use HasFactory; protected $table = 'ls_session'; + protected $primaryKey = 'session_id'; public function state() diff --git a/app/Models/LegiScan/Signal.php b/app/Models/LegiScan/Signal.php index 9c9a720..8383590 100644 --- a/app/Models/LegiScan/Signal.php +++ b/app/Models/LegiScan/Signal.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class Signal extends Model { use HasFactory; protected $table = 'ls_signal'; + protected $primaryKey = ''; // object_type, object_id } diff --git a/app/Models/LegiScan/SponsorType.php b/app/Models/LegiScan/SponsorType.php index 2f14caf..dbae93b 100644 --- a/app/Models/LegiScan/SponsorType.php +++ b/app/Models/LegiScan/SponsorType.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class SponsorType extends Model { use HasFactory; protected $table = 'ls_sponsor_type'; + protected $primaryKey = 'sponsor_type_id'; } diff --git a/app/Models/LegiScan/Stance.php b/app/Models/LegiScan/Stance.php index 838d3f6..8925b07 100644 --- a/app/Models/LegiScan/Stance.php +++ b/app/Models/LegiScan/Stance.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class Stance extends Model { use HasFactory; protected $table = 'ls_stance'; + protected $primaryKey = 'stance'; } diff --git a/app/Models/LegiScan/State.php b/app/Models/LegiScan/State.php index a22667d..75b8c3d 100644 --- a/app/Models/LegiScan/State.php +++ b/app/Models/LegiScan/State.php @@ -29,4 +29,9 @@ public function bills() { return $this->hasMany(Bill::class, 'state_id'); } + + public function scopeNonNational($query) + { + $query->whereNotIn('abbreviation', ['DC', 'US']); + } } diff --git a/app/Models/LegiScan/Subject.php b/app/Models/LegiScan/Subject.php index aa66f8c..5b5916b 100644 --- a/app/Models/LegiScan/Subject.php +++ b/app/Models/LegiScan/Subject.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class Subject extends Model { use HasFactory; protected $table = 'ls_subject'; + protected $primaryKey = 'subject_id'; } diff --git a/app/Models/LegiScan/SupplementType.php b/app/Models/LegiScan/SupplementType.php index f5631e3..82b0732 100644 --- a/app/Models/LegiScan/SupplementType.php +++ b/app/Models/LegiScan/SupplementType.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class SupplementType extends Model { use HasFactory; protected $table = 'ls_supplement_type'; + protected $primaryKey = 'supplement_type_id'; } diff --git a/app/Models/LegiScan/TextType.php b/app/Models/LegiScan/TextType.php index 6e5a45a..e16491e 100644 --- a/app/Models/LegiScan/TextType.php +++ b/app/Models/LegiScan/TextType.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class TextType extends Model { use HasFactory; protected $table = 'ls_text_type'; + protected $primaryKey = 'bill_text_type_id'; } diff --git a/app/Models/LegiScan/Type.php b/app/Models/LegiScan/Type.php index ee8cdf5..719acb5 100644 --- a/app/Models/LegiScan/Type.php +++ b/app/Models/LegiScan/Type.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class Type extends Model { use HasFactory; protected $table = 'ls_type'; + protected $primaryKey = 'bill_type_id'; } diff --git a/app/Models/LegiScan/Variable.php b/app/Models/LegiScan/Variable.php index c88ac88..5d372f3 100644 --- a/app/Models/LegiScan/Variable.php +++ b/app/Models/LegiScan/Variable.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class Variable extends Model { use HasFactory; protected $table = 'ls_variable'; + protected $primaryKey = 'name'; } diff --git a/app/Models/LegiScan/Vote.php b/app/Models/LegiScan/Vote.php index d85934b..be1cf1e 100644 --- a/app/Models/LegiScan/Vote.php +++ b/app/Models/LegiScan/Vote.php @@ -2,13 +2,14 @@ namespace App\Models\LegiScan; -use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; +use Illuminate\Database\Eloquent\Factories\HasFactory; class Vote extends Model { use HasFactory; protected $table = 'ls_vote'; + protected $primaryKey = 'vote_id'; } diff --git a/app/Models/User.php b/app/Models/User.php index a30ca94..6809431 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -3,16 +3,16 @@ namespace App\Models; // use Illuminate\Contracts\Auth\MustVerifyEmail; +use Laravel\Sanctum\HasApiTokens; +use Illuminate\Notifications\Notifiable; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; -use Illuminate\Notifications\Notifiable; -use Laravel\Sanctum\HasApiTokens; class User extends Authenticatable { use HasApiTokens, HasFactory, Notifiable; - #region Properties + //region Properties /** * The attributes that are mass assignable. @@ -44,6 +44,5 @@ class User extends Authenticatable 'email_verified_at' => 'datetime', ]; - #endregion - + //endregion } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index ee8ca5b..0de8184 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -13,7 +13,6 @@ class AppServiceProvider extends ServiceProvider */ public function register() { - // } /** @@ -23,6 +22,5 @@ public function register() */ public function boot() { - // } } diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 33b83f5..d7265ee 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -24,7 +24,5 @@ class AuthServiceProvider extends ServiceProvider public function boot() { $this->registerPolicies(); - - // } } diff --git a/app/Providers/BroadcastServiceProvider.php b/app/Providers/BroadcastServiceProvider.php index 395c518..352cce4 100644 --- a/app/Providers/BroadcastServiceProvider.php +++ b/app/Providers/BroadcastServiceProvider.php @@ -2,8 +2,8 @@ namespace App\Providers; -use Illuminate\Support\Facades\Broadcast; use Illuminate\Support\ServiceProvider; +use Illuminate\Support\Facades\Broadcast; class BroadcastServiceProvider extends ServiceProvider { diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index ab8b2cf..fe18fa7 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -2,10 +2,10 @@ namespace App\Providers; +use Illuminate\Support\Facades\Event; use Illuminate\Auth\Events\Registered; use Illuminate\Auth\Listeners\SendEmailVerificationNotification; use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; -use Illuminate\Support\Facades\Event; class EventServiceProvider extends ServiceProvider { @@ -27,7 +27,6 @@ class EventServiceProvider extends ServiceProvider */ public function boot() { - // } /** diff --git a/app/Providers/FortifyServiceProvider.php b/app/Providers/FortifyServiceProvider.php index 9f2f3c1..927bbaa 100644 --- a/app/Providers/FortifyServiceProvider.php +++ b/app/Providers/FortifyServiceProvider.php @@ -2,15 +2,15 @@ namespace App\Providers; +use Illuminate\Http\Request; +use Laravel\Fortify\Fortify; use App\Actions\Fortify\CreateNewUser; +use Illuminate\Support\ServiceProvider; +use Illuminate\Cache\RateLimiting\Limit; use App\Actions\Fortify\ResetUserPassword; use App\Actions\Fortify\UpdateUserPassword; -use App\Actions\Fortify\UpdateUserProfileInformation; -use Illuminate\Cache\RateLimiting\Limit; -use Illuminate\Http\Request; use Illuminate\Support\Facades\RateLimiter; -use Illuminate\Support\ServiceProvider; -use Laravel\Fortify\Fortify; +use App\Actions\Fortify\UpdateUserProfileInformation; class FortifyServiceProvider extends ServiceProvider { @@ -21,7 +21,6 @@ class FortifyServiceProvider extends ServiceProvider */ public function register() { - // } /** @@ -39,7 +38,7 @@ public function boot() RateLimiter::for('login', function (Request $request) { $email = (string) $request->email; - return Limit::perMinute(5)->by($email.$request->ip()); + return Limit::perMinute(5)->by($email . $request->ip()); }); RateLimiter::for('two-factor', function (Request $request) { diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index ea87f2e..fda5608 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -2,11 +2,11 @@ namespace App\Providers; -use Illuminate\Cache\RateLimiting\Limit; -use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; use Illuminate\Http\Request; -use Illuminate\Support\Facades\RateLimiter; use Illuminate\Support\Facades\Route; +use Illuminate\Cache\RateLimiting\Limit; +use Illuminate\Support\Facades\RateLimiter; +use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; class RouteServiceProvider extends ServiceProvider { diff --git a/app/View/Components/Navbar/Index.php b/app/View/Components/Navbar/Index.php index a9969b7..076bf8b 100644 --- a/app/View/Components/Navbar/Index.php +++ b/app/View/Components/Navbar/Index.php @@ -13,7 +13,6 @@ class Index extends Component */ public function __construct() { - // } /** diff --git a/app/View/Components/Navbar/Link.php b/app/View/Components/Navbar/Link.php index d758cf3..d3d0cac 100644 --- a/app/View/Components/Navbar/Link.php +++ b/app/View/Components/Navbar/Link.php @@ -6,21 +6,12 @@ class Link extends Component { - /** - * Create a new component instance. - * - * @return void - */ - public function __construct( - public $href, - public $active = false, - ) {} + public bool $active = false; + + public function __construct(public $href) + { + } - /** - * Get the view / contents that represent the component. - * - * @return \Illuminate\Contracts\View\View|\Closure|string - */ public function render() { return view('components.navbar.link'); diff --git a/config/auth.php b/config/auth.php index d8c6cee..413cfe3 100644 --- a/config/auth.php +++ b/config/auth.php @@ -14,7 +14,7 @@ */ 'defaults' => [ - 'guard' => 'web', + 'guard' => 'web', 'passwords' => 'users', ], @@ -37,7 +37,7 @@ 'guards' => [ 'web' => [ - 'driver' => 'session', + 'driver' => 'session', 'provider' => 'users', ], ], @@ -62,7 +62,7 @@ 'providers' => [ 'users' => [ 'driver' => 'eloquent', - 'model' => App\Models\User::class, + 'model' => App\Models\User::class, ], // 'users' => [ @@ -89,8 +89,8 @@ 'passwords' => [ 'users' => [ 'provider' => 'users', - 'table' => 'password_resets', - 'expire' => 60, + 'table' => 'password_resets', + 'expire' => 60, 'throttle' => 60, ], ], diff --git a/config/broadcasting.php b/config/broadcasting.php index 1688242..ff2b30b 100644 --- a/config/broadcasting.php +++ b/config/broadcasting.php @@ -31,16 +31,16 @@ 'connections' => [ 'pusher' => [ - 'driver' => 'pusher', - 'key' => env('PUSHER_APP_KEY'), - 'secret' => env('PUSHER_APP_SECRET'), - 'app_id' => env('PUSHER_APP_ID'), + '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'), + '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', + 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https', ], 'client_options' => [ // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html @@ -49,11 +49,11 @@ 'ably' => [ 'driver' => 'ably', - 'key' => env('ABLY_KEY'), + 'key' => env('ABLY_KEY'), ], 'redis' => [ - 'driver' => 'redis', + 'driver' => 'redis', 'connection' => 'default', ], diff --git a/config/cache.php b/config/cache.php index 33bb295..79d3d5f 100644 --- a/config/cache.php +++ b/config/cache.php @@ -38,26 +38,26 @@ ], 'array' => [ - 'driver' => 'array', + 'driver' => 'array', 'serialize' => false, ], 'database' => [ - 'driver' => 'database', - 'table' => 'cache', - 'connection' => null, + 'driver' => 'database', + 'table' => 'cache', + 'connection' => null, 'lock_connection' => null, ], 'file' => [ 'driver' => 'file', - 'path' => storage_path('framework/cache/data'), + 'path' => storage_path('framework/cache/data'), ], 'memcached' => [ - 'driver' => 'memcached', + 'driver' => 'memcached', 'persistent_id' => env('MEMCACHED_PERSISTENT_ID'), - 'sasl' => [ + 'sasl' => [ env('MEMCACHED_USERNAME'), env('MEMCACHED_PASSWORD'), ], @@ -66,25 +66,25 @@ ], 'servers' => [ [ - 'host' => env('MEMCACHED_HOST', '127.0.0.1'), - 'port' => env('MEMCACHED_PORT', 11211), + 'host' => env('MEMCACHED_HOST', '127.0.0.1'), + 'port' => env('MEMCACHED_PORT', 11211), 'weight' => 100, ], ], ], 'redis' => [ - 'driver' => 'redis', - 'connection' => 'cache', + 'driver' => 'redis', + 'connection' => 'cache', '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'), + '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'), ], @@ -105,6 +105,6 @@ | */ - 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'), + 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_cache_'), ]; diff --git a/config/database.php b/config/database.php index 137ad18..1b5923a 100644 --- a/config/database.php +++ b/config/database.php @@ -36,58 +36,58 @@ 'connections' => [ 'sqlite' => [ - 'driver' => 'sqlite', - 'url' => env('DATABASE_URL'), - 'database' => env('DB_DATABASE', database_path('database.sqlite')), - 'prefix' => '', + 'driver' => 'sqlite', + 'url' => env('DATABASE_URL'), + 'database' => env('DB_DATABASE', database_path('database.sqlite')), + 'prefix' => '', 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), ], 'mysql' => [ - 'driver' => 'mysql', - 'url' => env('DATABASE_URL'), - 'host' => env('DB_HOST', '127.0.0.1'), - 'port' => env('DB_PORT', '3306'), - 'database' => env('DB_DATABASE', 'forge'), - 'username' => env('DB_USERNAME', 'forge'), - 'password' => env('DB_PASSWORD', ''), - 'unix_socket' => env('DB_SOCKET', ''), - 'charset' => 'utf8mb4', - 'collation' => 'utf8mb4_unicode_ci', - 'prefix' => '', + 'driver' => 'mysql', + 'url' => env('DATABASE_URL'), + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '3306'), + 'database' => env('DB_DATABASE', 'forge'), + 'username' => env('DB_USERNAME', 'forge'), + 'password' => env('DB_PASSWORD', ''), + 'unix_socket' => env('DB_SOCKET', ''), + 'charset' => 'utf8mb4', + 'collation' => 'utf8mb4_unicode_ci', + 'prefix' => '', 'prefix_indexes' => true, - 'strict' => true, - 'engine' => null, - 'options' => extension_loaded('pdo_mysql') ? array_filter([ + 'strict' => true, + 'engine' => null, + 'options' => extension_loaded('pdo_mysql') ? array_filter([ PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), ]) : [], ], 'pgsql' => [ - 'driver' => 'pgsql', - 'url' => env('DATABASE_URL'), - 'host' => env('DB_HOST', '127.0.0.1'), - 'port' => env('DB_PORT', '5432'), - 'database' => env('DB_DATABASE', 'forge'), - 'username' => env('DB_USERNAME', 'forge'), - 'password' => env('DB_PASSWORD', ''), - 'charset' => 'utf8', - 'prefix' => '', + 'driver' => 'pgsql', + 'url' => env('DATABASE_URL'), + 'host' => env('DB_HOST', '127.0.0.1'), + 'port' => env('DB_PORT', '5432'), + 'database' => env('DB_DATABASE', 'forge'), + 'username' => env('DB_USERNAME', 'forge'), + 'password' => env('DB_PASSWORD', ''), + 'charset' => 'utf8', + 'prefix' => '', 'prefix_indexes' => true, - 'search_path' => 'public', - 'sslmode' => 'prefer', + 'search_path' => 'public', + 'sslmode' => 'prefer', ], 'sqlsrv' => [ - 'driver' => 'sqlsrv', - 'url' => env('DATABASE_URL'), - 'host' => env('DB_HOST', 'localhost'), - 'port' => env('DB_PORT', '1433'), - 'database' => env('DB_DATABASE', 'forge'), - 'username' => env('DB_USERNAME', 'forge'), - 'password' => env('DB_PASSWORD', ''), - 'charset' => 'utf8', - 'prefix' => '', + 'driver' => 'sqlsrv', + 'url' => env('DATABASE_URL'), + 'host' => env('DB_HOST', 'localhost'), + 'port' => env('DB_PORT', '1433'), + 'database' => env('DB_DATABASE', 'forge'), + 'username' => env('DB_USERNAME', 'forge'), + 'password' => env('DB_PASSWORD', ''), + 'charset' => 'utf8', + 'prefix' => '', 'prefix_indexes' => true, // 'encrypt' => env('DB_ENCRYPT', 'yes'), // 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'), @@ -125,24 +125,24 @@ 'options' => [ 'cluster' => env('REDIS_CLUSTER', 'redis'), - 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), + 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_database_'), ], 'default' => [ - 'url' => env('REDIS_URL'), - 'host' => env('REDIS_HOST', '127.0.0.1'), + 'url' => env('REDIS_URL'), + 'host' => env('REDIS_HOST', '127.0.0.1'), 'username' => env('REDIS_USERNAME'), 'password' => env('REDIS_PASSWORD'), - 'port' => env('REDIS_PORT', '6379'), + 'port' => env('REDIS_PORT', '6379'), 'database' => env('REDIS_DB', '0'), ], 'cache' => [ - 'url' => env('REDIS_URL'), - 'host' => env('REDIS_HOST', '127.0.0.1'), + 'url' => env('REDIS_URL'), + 'host' => env('REDIS_HOST', '127.0.0.1'), 'username' => env('REDIS_USERNAME'), 'password' => env('REDIS_PASSWORD'), - 'port' => env('REDIS_PORT', '6379'), + 'port' => env('REDIS_PORT', '6379'), 'database' => env('REDIS_CACHE_DB', '1'), ], diff --git a/config/filesystems.php b/config/filesystems.php index 5d21a29..6ae4e31 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -32,28 +32,28 @@ 'local' => [ 'driver' => 'local', - 'root' => storage_path('app'), - 'throw' => false, + 'root' => storage_path('app'), + 'throw' => false, ], 'public' => [ - 'driver' => 'local', - 'root' => storage_path('app/public'), - 'url' => env('APP_URL').'/storage', + 'driver' => 'local', + 'root' => storage_path('app/public'), + 'url' => env('APP_URL') . '/storage', 'visibility' => 'public', - 'throw' => false, + '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'), + '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, + 'throw' => false, ], ], @@ -71,7 +71,7 @@ 'links' => [ base_path('lib/legiscan/config.php') => base_path('legiscan.config.php'), - public_path('storage') => storage_path('app/public'), + public_path('storage') => storage_path('app/public'), ], ]; diff --git a/config/fortify.php b/config/fortify.php index 510a539..9374267 100644 --- a/config/fortify.php +++ b/config/fortify.php @@ -1,7 +1,7 @@ [ - 'login' => 'login', + 'login' => 'login', 'two-factor' => 'two-factor', ], @@ -138,7 +138,7 @@ Features::updateProfileInformation(), Features::updatePasswords(), Features::twoFactorAuthentication([ - 'confirm' => true, + 'confirm' => true, 'confirmPassword' => true, // 'window' => 0, ]), diff --git a/config/hashing.php b/config/hashing.php index bcd3be4..6160594 100644 --- a/config/hashing.php +++ b/config/hashing.php @@ -44,9 +44,9 @@ */ 'argon' => [ - 'memory' => 65536, + 'memory' => 65536, 'threads' => 1, - 'time' => 4, + 'time' => 4, ], ]; diff --git a/config/legiscan.php b/config/legiscan.php index 2b1c0d3..bde78c1 100644 --- a/config/legiscan.php +++ b/config/legiscan.php @@ -2,6 +2,6 @@ return [ - 'api_key' => env('LEGISCAN_API_KEY') + 'api_key' => env('LEGISCAN_API_KEY'), ]; diff --git a/config/logging.php b/config/logging.php index 5aa1dbb..1aa4ee4 100644 --- a/config/logging.php +++ b/config/logging.php @@ -32,7 +32,7 @@ 'deprecations' => [ 'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'), - 'trace' => false, + 'trace' => false, ], /* @@ -52,65 +52,65 @@ 'channels' => [ 'stack' => [ - 'driver' => 'stack', - 'channels' => ['single'], + 'driver' => 'stack', + 'channels' => ['single'], 'ignore_exceptions' => false, ], 'single' => [ 'driver' => 'single', - 'path' => storage_path('logs/laravel.log'), - 'level' => env('LOG_LEVEL', 'debug'), + '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' => 14, + 'path' => storage_path('logs/laravel.log'), + 'level' => env('LOG_LEVEL', 'debug'), + 'days' => 14, ], 'slack' => [ - 'driver' => 'slack', - 'url' => env('LOG_SLACK_WEBHOOK_URL'), + 'driver' => 'slack', + 'url' => env('LOG_SLACK_WEBHOOK_URL'), 'username' => 'Laravel Log', - 'emoji' => ':boom:', - 'level' => env('LOG_LEVEL', 'critical'), + 'emoji' => ':boom:', + 'level' => env('LOG_LEVEL', 'critical'), ], 'papertrail' => [ - 'driver' => 'monolog', - 'level' => env('LOG_LEVEL', 'debug'), - 'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class), + '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'), + '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, + 'driver' => 'monolog', + 'level' => env('LOG_LEVEL', 'debug'), + 'handler' => StreamHandler::class, 'formatter' => env('LOG_STDERR_FORMATTER'), - 'with' => [ + 'with' => [ 'stream' => 'php://stderr', ], ], 'syslog' => [ 'driver' => 'syslog', - 'level' => env('LOG_LEVEL', 'debug'), + 'level' => env('LOG_LEVEL', 'debug'), ], 'errorlog' => [ 'driver' => 'errorlog', - 'level' => env('LOG_LEVEL', 'debug'), + 'level' => env('LOG_LEVEL', 'debug'), ], 'null' => [ - 'driver' => 'monolog', + 'driver' => 'monolog', 'handler' => NullHandler::class, ], diff --git a/config/mail.php b/config/mail.php index 534395a..3093150 100644 --- a/config/mail.php +++ b/config/mail.php @@ -35,13 +35,13 @@ '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, + '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'), ], @@ -59,12 +59,12 @@ 'sendmail' => [ 'transport' => 'sendmail', - 'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'), + 'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'), ], 'log' => [ 'transport' => 'log', - 'channel' => env('MAIL_LOG_CHANNEL'), + 'channel' => env('MAIL_LOG_CHANNEL'), ], 'array' => [ @@ -73,7 +73,7 @@ 'failover' => [ 'transport' => 'failover', - 'mailers' => [ + 'mailers' => [ 'smtp', 'log', ], @@ -93,7 +93,7 @@ 'from' => [ 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), - 'name' => env('MAIL_FROM_NAME', 'Example'), + 'name' => env('MAIL_FROM_NAME', 'Example'), ], /* diff --git a/config/permission.php b/config/permission.php index 5b6e184..276fa9e 100644 --- a/config/permission.php +++ b/config/permission.php @@ -75,7 +75,7 @@ /* * Change this if you want to name the related pivots other than defaults */ - 'role_pivot_key' => null, //default 'role_id', + 'role_pivot_key' => null, //default 'role_id', 'permission_pivot_key' => null, //default 'permission_id', /* diff --git a/config/queue.php b/config/queue.php index 25ea5a8..84f7438 100644 --- a/config/queue.php +++ b/config/queue.php @@ -35,39 +35,39 @@ ], 'database' => [ - 'driver' => 'database', - 'table' => 'jobs', - 'queue' => 'default', - 'retry_after' => 90, + 'driver' => 'database', + 'table' => 'jobs', + 'queue' => 'default', + 'retry_after' => 90, 'after_commit' => false, ], 'beanstalkd' => [ - 'driver' => 'beanstalkd', - 'host' => 'localhost', - 'queue' => 'default', - 'retry_after' => 90, - 'block_for' => 0, + 'driver' => 'beanstalkd', + 'host' => 'localhost', + 'queue' => 'default', + 'retry_after' => 90, + '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'), + '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, ], 'redis' => [ - 'driver' => 'redis', - 'connection' => 'default', - 'queue' => env('REDIS_QUEUE', 'default'), - 'retry_after' => 90, - 'block_for' => null, + 'driver' => 'redis', + 'connection' => 'default', + 'queue' => env('REDIS_QUEUE', 'default'), + 'retry_after' => 90, + 'block_for' => null, 'after_commit' => false, ], @@ -85,9 +85,9 @@ */ 'failed' => [ - 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), + 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), 'database' => env('DB_CONNECTION', 'mysql'), - 'table' => 'failed_jobs', + 'table' => 'failed_jobs', ], ]; diff --git a/config/sanctum.php b/config/sanctum.php index 529cfdc..e71426a 100644 --- a/config/sanctum.php +++ b/config/sanctum.php @@ -61,7 +61,7 @@ 'middleware' => [ 'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class, - 'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class, + 'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class, ], ]; diff --git a/config/services.php b/config/services.php index 0ace530..2de427f 100644 --- a/config/services.php +++ b/config/services.php @@ -15,10 +15,10 @@ */ 'mailgun' => [ - 'domain' => env('MAILGUN_DOMAIN'), - 'secret' => env('MAILGUN_SECRET'), + 'domain' => env('MAILGUN_DOMAIN'), + 'secret' => env('MAILGUN_SECRET'), 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), - 'scheme' => 'https', + 'scheme' => 'https', ], 'postmark' => [ @@ -26,7 +26,7 @@ ], 'ses' => [ - 'key' => env('AWS_ACCESS_KEY_ID'), + 'key' => env('AWS_ACCESS_KEY_ID'), 'secret' => env('AWS_SECRET_ACCESS_KEY'), 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), ], diff --git a/config/session.php b/config/session.php index 8fed97c..1b99f22 100644 --- a/config/session.php +++ b/config/session.php @@ -128,7 +128,7 @@ 'cookie' => env( 'SESSION_COOKIE', - Str::slug(env('APP_NAME', 'laravel'), '_').'_session' + Str::slug(env('APP_NAME', 'laravel'), '_') . '_session' ), /* diff --git a/database/factories/LegiScan/BillFactory.php b/database/factories/LegiScan/BillFactory.php index eb15aa5..0c1e003 100644 --- a/database/factories/LegiScan/BillFactory.php +++ b/database/factories/LegiScan/BillFactory.php @@ -12,16 +12,16 @@ class BillFactory extends Factory public function definition() { return [ - 'bill_number' => 'LB' . $this->faker->randomNumber(4, true), - 'status_date' => $this->faker->date('Y-m-d'), - 'title' => $this->faker->sentence(), - 'description' => $this->faker->paragraph(), + 'bill_number' => 'LB' . $this->faker->randomNumber(4, true), + 'status_date' => $this->faker->date('Y-m-d'), + 'title' => $this->faker->sentence(), + 'description' => $this->faker->paragraph(), 'pending_committee_id' => 0, - 'legiscan_url' => $this->faker->url(), - 'state_url' => $this->faker->url(), - 'change_hash' => $this->faker->md5(), - 'updated' => $this->faker->dateTime(), - 'created' => $this->faker->dateTime(), + 'legiscan_url' => $this->faker->url(), + 'state_url' => $this->faker->url(), + 'change_hash' => $this->faker->md5(), + 'updated' => $this->faker->dateTime(), + 'created' => $this->faker->dateTime(), ]; } } diff --git a/database/factories/LegiScan/StateFactory.php b/database/factories/LegiScan/StateFactory.php index 34525cc..6f83fdc 100644 --- a/database/factories/LegiScan/StateFactory.php +++ b/database/factories/LegiScan/StateFactory.php @@ -16,8 +16,8 @@ class StateFactory extends Factory public function definition() { return [ - 'id' => (State::all()->max('id') ?? 0) + 1, - 'name' => $this->faker->state, + 'id' => (State::all()->max('id') ?? 0) + 1, + 'name' => $this->faker->state, 'abbreviation' => $this->faker->stateAbbr, 'biennium' => rand(0, 1), 'carry_over' => Arr::random(State::getEnum('carryOver')), diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index 20b3532..466c2d7 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -2,8 +2,8 @@ namespace Database\Factories; -use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Str; +use Illuminate\Database\Eloquent\Factories\Factory; /** * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User> @@ -18,11 +18,11 @@ class UserFactory extends Factory public function definition() { return [ - 'name' => fake()->name(), - 'email' => fake()->safeEmail(), + 'name' => fake()->name(), + 'email' => fake()->safeEmail(), 'email_verified_at' => now(), - 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password - 'remember_token' => Str::random(10), + 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password + 'remember_token' => Str::random(10), ]; } diff --git a/database/migrations/2000_01_01_000000_legiscan_import.php b/database/migrations/2000_01_01_000000_legiscan_import.php index cc19cec..39975f5 100644 --- a/database/migrations/2000_01_01_000000_legiscan_import.php +++ b/database/migrations/2000_01_01_000000_legiscan_import.php @@ -1,13 +1,12 @@ string('composite_id')->virtualAs('bill_id || "-" || event_hash')->index(); - }); } @@ -28,9 +25,7 @@ public function up() public function down() { Schema::table('ls_bill_calendar', function (Blueprint $table) { - $table->dropColumn('composite_id'); - }); } }; diff --git a/database/migrations/2022_08_20_230557_bill_history_composite_id.php b/database/migrations/2022_08_20_230557_bill_history_composite_id.php index dbb1a77..2011a9a 100644 --- a/database/migrations/2022_08_20_230557_bill_history_composite_id.php +++ b/database/migrations/2022_08_20_230557_bill_history_composite_id.php @@ -1,11 +1,10 @@ string('composite_id')->virtualAs('bill_id || "-" || history_step')->index(); - }); } @@ -28,9 +25,7 @@ public function up() public function down() { Schema::table('ls_bill_history', function (Blueprint $table) { - $table->dropColumn('composite_id'); - }); } }; diff --git a/database/migrations/2022_08_20_231106_bill_progress_composite_id.php b/database/migrations/2022_08_20_231106_bill_progress_composite_id.php index 269e73b..9faecca 100644 --- a/database/migrations/2022_08_20_231106_bill_progress_composite_id.php +++ b/database/migrations/2022_08_20_231106_bill_progress_composite_id.php @@ -1,11 +1,10 @@ string('composite_id')->virtualAs('bill_id || "-" || progress_step')->index(); - }); } @@ -28,9 +25,7 @@ public function up() public function down() { Schema::table('ls_bill_progress', function (Blueprint $table) { - $table->dropColumn('composite_id'); - }); } }; diff --git a/database/migrations/2022_08_20_231332_bill_reason_composite_id.php b/database/migrations/2022_08_20_231332_bill_reason_composite_id.php index 72a5ba6..294d177 100644 --- a/database/migrations/2022_08_20_231332_bill_reason_composite_id.php +++ b/database/migrations/2022_08_20_231332_bill_reason_composite_id.php @@ -1,11 +1,10 @@ string('composite_id')->virtualAs('bill_id || "-" || reason_id')->index(); - }); } @@ -28,9 +25,7 @@ public function up() public function down() { Schema::table('ls_bill_reason', function (Blueprint $table) { - $table->dropColumn('composite_id'); - }); } }; diff --git a/database/migrations/2022_08_20_232251_bill_referral_composite_id.php b/database/migrations/2022_08_20_232251_bill_referral_composite_id.php index 2b4fe99..fd99769 100644 --- a/database/migrations/2022_08_20_232251_bill_referral_composite_id.php +++ b/database/migrations/2022_08_20_232251_bill_referral_composite_id.php @@ -1,11 +1,10 @@ string('composite_id')->virtualAs('bill_id || "-" || referral_step')->index(); - }); } @@ -28,9 +25,7 @@ public function up() public function down() { Schema::table('ls_bill_referral', function (Blueprint $table) { - $table->dropColumn('composite_id'); - }); } }; diff --git a/database/migrations/2022_08_21_004858_bill_vote_detail_composite_id.php b/database/migrations/2022_08_21_004858_bill_vote_detail_composite_id.php index a34e40a..af81bf8 100644 --- a/database/migrations/2022_08_21_004858_bill_vote_detail_composite_id.php +++ b/database/migrations/2022_08_21_004858_bill_vote_detail_composite_id.php @@ -1,11 +1,10 @@ string('composite_id')->virtualAs('roll_call_id || "-" || people_id')->index(); - }); } @@ -28,9 +25,7 @@ public function up() public function down() { Schema::table('ls_bill_vote_detail', function (Blueprint $table) { - $table->dropColumn('composite_id'); - }); } }; diff --git a/database/migrations/2022_09_18_024058_legiscan_bill_table.php b/database/migrations/2022_09_18_024058_legiscan_bill_table.php index 84b1b8c..0a0de15 100644 --- a/database/migrations/2022_09_18_024058_legiscan_bill_table.php +++ b/database/migrations/2022_09_18_024058_legiscan_bill_table.php @@ -1,11 +1,10 @@ index('status_date', 'ls_bill_status_date_idx'); - }); } @@ -28,9 +25,7 @@ public function up() public function down() { Schema::table('ls_bill', function (Blueprint $table) { - $table->dropIndex('ls_bill_status_date_idx'); - }); } }; diff --git a/database/migrations/2022_09_18_162851_create_permission_tables.php b/database/migrations/2022_09_18_162851_create_permission_tables.php index 04c3278..c715ff5 100644 --- a/database/migrations/2022_09_18_162851_create_permission_tables.php +++ b/database/migrations/2022_09_18_162851_create_permission_tables.php @@ -2,8 +2,8 @@ use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; -use Illuminate\Database\Migrations\Migration; use Spatie\Permission\PermissionRegistrar; +use Illuminate\Database\Migrations\Migration; class CreatePermissionTables extends Migration { @@ -14,9 +14,9 @@ class CreatePermissionTables extends Migration */ public function up() { - $tableNames = config('permission.table_names'); + $tableNames = config('permission.table_names'); $columnNames = config('permission.column_names'); - $teams = config('permission.teams'); + $teams = config('permission.teams'); if (empty($tableNames)) { throw new \Exception('Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.'); @@ -65,13 +65,16 @@ public function up() $table->unsignedBigInteger($columnNames['team_foreign_key']); $table->index($columnNames['team_foreign_key'], 'model_has_permissions_team_foreign_key_index'); - $table->primary([$columnNames['team_foreign_key'], PermissionRegistrar::$pivotPermission, $columnNames['model_morph_key'], 'model_type'], - 'model_has_permissions_permission_model_type_primary'); + $table->primary( + [$columnNames['team_foreign_key'], PermissionRegistrar::$pivotPermission, $columnNames['model_morph_key'], 'model_type'], + 'model_has_permissions_permission_model_type_primary' + ); } else { - $table->primary([PermissionRegistrar::$pivotPermission, $columnNames['model_morph_key'], 'model_type'], - 'model_has_permissions_permission_model_type_primary'); + $table->primary( + [PermissionRegistrar::$pivotPermission, $columnNames['model_morph_key'], 'model_type'], + 'model_has_permissions_permission_model_type_primary' + ); } - }); Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames, $teams) { @@ -89,11 +92,15 @@ public function up() $table->unsignedBigInteger($columnNames['team_foreign_key']); $table->index($columnNames['team_foreign_key'], 'model_has_roles_team_foreign_key_index'); - $table->primary([$columnNames['team_foreign_key'], PermissionRegistrar::$pivotRole, $columnNames['model_morph_key'], 'model_type'], - 'model_has_roles_role_model_type_primary'); + $table->primary( + [$columnNames['team_foreign_key'], PermissionRegistrar::$pivotRole, $columnNames['model_morph_key'], 'model_type'], + 'model_has_roles_role_model_type_primary' + ); } else { - $table->primary([PermissionRegistrar::$pivotRole, $columnNames['model_morph_key'], 'model_type'], - 'model_has_roles_role_model_type_primary'); + $table->primary( + [PermissionRegistrar::$pivotRole, $columnNames['model_morph_key'], 'model_type'], + 'model_has_roles_role_model_type_primary' + ); } }); diff --git a/database/migrations/2022_10_03_200810_create_states_table.php b/database/migrations/2022_10_03_200810_create_states_table.php index 66ad128..bddbabf 100644 --- a/database/migrations/2022_10_03_200810_create_states_table.php +++ b/database/migrations/2022_10_03_200810_create_states_table.php @@ -1,11 +1,10 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/resources/views/livewire/bill-table.blade.php b/resources/views/livewire/bill-table.blade.php index 816e4dd..2c5a2e7 100644 --- a/resources/views/livewire/bill-table.blade.php +++ b/resources/views/livewire/bill-table.blade.php @@ -82,10 +82,10 @@ {{-- Latest --}} - {{ $bill->history_items()->orderByDesc('history_date')->first()->history_date }} + {{ $bill->historyItems()->orderByDesc('history_date')->first()->history_date }} diff --git a/resources/views/pages/home/index.blade.php b/resources/views/pages/home/index.blade.php index 284843c..42e802c 100644 --- a/resources/views/pages/home/index.blade.php +++ b/resources/views/pages/home/index.blade.php @@ -9,7 +9,7 @@ @foreach ($states as $state)
- {{ $state->state_name }} + {{ $state->name }} ({{ number_format($state->bills->count()) }})
@@ -20,12 +20,14 @@
- {{ $us->state_name }} - ({{ number_format($us->bills->count()) }}) + {{ $unitedStates->name }} + ({{ number_format($unitedStates->bills->count()) }})
- {{ $dc->state_name }} - ({{ number_format($dc->bills->count()) }}) + + {{ $districtOfColumbia->name }} + + ({{ number_format($districtOfColumbia->bills->count()) }})
diff --git a/routes/api.php b/routes/api.php index e65f88c..4b3d47d 100644 --- a/routes/api.php +++ b/routes/api.php @@ -1,64 +1,64 @@ user(); }); -Route::prefix('legiscan/raw-data')->group(function(){ - +Route::prefix('legiscan/raw-data')->group(function () { $models = [ Bill::class, @@ -147,37 +146,31 @@ ]; foreach ($models as $model) { - - $table = app($model)->getTable(); + $table = app($model)->getTable(); $table_name_parts = explode('_', $table); - $prefix = array_shift($table_name_parts); + $prefix = array_shift($table_name_parts); $path = implode('-', $table_name_parts); if ($prefix == 'ls') { // pass - } - else if ($prefix == 'lsv') { + } elseif ($prefix == 'lsv') { $path .= '-view'; - } - else { - $path = $prefix.'-'.$path; + } else { + $path = $prefix . '-' . $path; } // Get the collection - Route::get($path, function() use ($model) { + Route::get($path, function () use ($model) { return JsonResource::collection($model::all()); }); // Get the resource - Route::get($path.'/{id}', function($id) use ($model) { + Route::get($path . '/{id}', function ($id) use ($model) { return new JsonResource($model::find($id)); }); - } - }); -Route::prefix('legiscan')->group(function(){ - +Route::prefix('legiscan')->group(function () { // Default is NE (state) and current session. // bill-summary @@ -187,11 +180,10 @@ // bill-vote-summary // bill-vote-summary/{$bill_id} - Route::get('bill', function(){ + Route::get('bill', function () { return BillDetailResource::collection(Bill::all()); }); - Route::get('bill/{id}', function($id){ + Route::get('bill/{id}', function ($id) { return new BillDetailResource(Bill::find($id)); }); - }); diff --git a/routes/web.php b/routes/web.php index 9f1ec66..378a505 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,8 +1,8 @@ make(Kernel::class)->bootstrap();