diff --git a/app/Contracts/Controller.php b/app/Contracts/Controller.php index a11dc93af..b491006ba 100755 --- a/app/Contracts/Controller.php +++ b/app/Contracts/Controller.php @@ -6,6 +6,7 @@ use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Http\Request; +use Laracasts\Flash\Flash; /** * Class Controller @@ -26,7 +27,7 @@ abstract class Controller extends \Illuminate\Routing\Controller */ public function flashError($message, $route) { - flash()->error($message); + Flash::error($message); return redirect(route($route))->withInput(); } diff --git a/app/Database/migrations/2019_06_19_220910_add_readonly_to_roles.php b/app/Database/migrations/2019_06_19_220910_add_readonly_to_roles.php index 1eaee12fe..65ecce470 100644 --- a/app/Database/migrations/2019_06_19_220910_add_readonly_to_roles.php +++ b/app/Database/migrations/2019_06_19_220910_add_readonly_to_roles.php @@ -2,6 +2,7 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; +use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Schema; class AddReadonlyToRoles extends Migration diff --git a/app/Database/migrations/2019_07_16_141152_users_add_pilot_id.php b/app/Database/migrations/2019_07_16_141152_users_add_pilot_id.php index caad035cf..5e743df1d 100644 --- a/app/Database/migrations/2019_07_16_141152_users_add_pilot_id.php +++ b/app/Database/migrations/2019_07_16_141152_users_add_pilot_id.php @@ -18,7 +18,7 @@ class UsersAddPilotId extends Migration */ public function up() { - Schema::table('users', function (Blueprint $table) { + Schema::table('users', static function (Blueprint $table) { $table->unsignedBigInteger('pilot_id') ->after('id') ->unique() @@ -26,8 +26,7 @@ public function up() ->index('users_pilot_id'); }); - // Migrate the current pilot IDs - DB::update('UPDATE `users` SET `pilot_id`=`id`'); + DB::table('users')->update(['pilot_id' => DB::raw('`id`')]); } /** diff --git a/app/Database/migrations/2019_09_16_141152_pireps_change_state_type.php b/app/Database/migrations/2019_09_16_141152_pireps_change_state_type.php index b3eb5e0c4..3f9ff9119 100644 --- a/app/Database/migrations/2019_09_16_141152_pireps_change_state_type.php +++ b/app/Database/migrations/2019_09_16_141152_pireps_change_state_type.php @@ -16,8 +16,9 @@ class PirepsChangeStateType extends Migration public function up() { // Migrate the old rejected state - DB::update('UPDATE `pireps` SET `state`='.PirepState::REJECTED - .' WHERE state=-1'); + DB::table('pireps') + ->where(['state' => -1]) + ->update(['state' => PirepState::REJECTED]); // Change the column type to an unsigned small int (tinyint not supported on all) Schema::table('pireps', function (Blueprint $table) { diff --git a/modules/Installer/Http/Controllers/InstallerController.php b/modules/Installer/Http/Controllers/InstallerController.php index 2c773676b..b07d46866 100644 --- a/modules/Installer/Http/Controllers/InstallerController.php +++ b/modules/Installer/Http/Controllers/InstallerController.php @@ -18,6 +18,7 @@ use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Validator; +use Laracasts\Flash\Flash; use Modules\Installer\Services\ConfigService; use Modules\Installer\Services\RequirementsService; @@ -196,7 +197,7 @@ public function envsetup(Request $request) Log::error('Testing db before writing configs failed'); Log::error($e->getMessage()); - flash()->error($e->getMessage()); + Flash::error($e->getMessage()); return redirect(route('installer.step2'))->withInput(); } @@ -224,7 +225,7 @@ public function envsetup(Request $request) Log::error('Config files failed to write'); Log::error($e->getMessage()); - flash()->error($e->getMessage()); + Flash::error($e->getMessage()); return redirect(route('installer.step2'))->withInput(); } @@ -238,7 +239,7 @@ public function envsetup(Request $request) * * @param Request $request * - * @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View + * @return mixed */ public function dbsetup(Request $request) { @@ -250,9 +251,9 @@ public function dbsetup(Request $request) $this->seederSvc->syncAllSeeds(); } catch (QueryException $e) { Log::error('Error on db setup: '.$e->getMessage()); - + dd($e); $this->envSvc->removeConfigFiles(); - flash()->error($e->getMessage()); + Flash::error($e->getMessage()); return redirect(route('installer.step2'))->withInput(); } diff --git a/modules/Installer/Resources/views/flash/message.blade.php b/modules/Installer/Resources/views/flash/message.blade.php index 40279a709..9e47c4fd4 100644 --- a/modules/Installer/Resources/views/flash/message.blade.php +++ b/modules/Installer/Resources/views/flash/message.blade.php @@ -1,11 +1,19 @@ -@foreach (session('flash_notification', []) as $message) - @endsection