diff --git a/.env.example b/.env.example index 3a550b7c4..95c99faf2 100644 --- a/.env.example +++ b/.env.example @@ -15,13 +15,13 @@ DB_PASSWORD=mariadb BROADCAST_DRIVER=log CACHE_DRIVER=file SESSION_DRIVER=file -QUEUE_DRIVER=sync +QUEUE_CONNECTION=sync REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379 -MAIL_DRIVER=smtp +MAIL_MAILER=smtp MAIL_HOST=mailtrap.io MAIL_PORT=2525 MAIL_USERNAME=null diff --git a/.gitignore b/.gitignore index 9c432ccb6..32c9c2d70 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,8 @@ package-lock.json .env-prod .env-local .env.testing +.env.backup +.env.production # Composer specific files composer.phar @@ -39,13 +41,18 @@ config/bd_users.initial.php config/bergfest_users.initial.php # IDE related files -.idea/ _ide_helper.php _ide_helper_models.php .phpstorm.meta.php +/.fleet +/.idea +/.vscode # Misc +/storage/*.key .DS_Store Thumbs.db +Homestead.json +Homestead.yaml .phpunit.* diff --git a/README.md b/README.md index 8b467fc76..5b3795d94 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -## Club management software built on top of Laravel 8 +## Club management software built on top of Laravel 9 ## About **Lara** is a planning tool that combines a calendar with personnel scheduling, developed for [Ilmenauer Studentenclub e.V.](http://www.il-sc.de) @@ -18,7 +18,7 @@ If you want to contribute, please read this short overview first: [Contributing] Code published under [GNU GPL v.3](https://github.com/ILSCeV/Lara/blob/master/LICENSE). Lara VedSt is based on: -- [Laravel 8](http://laravel.com) +- [Laravel 9](http://laravel.com) - [Bootswatch](http://bootswatch.com) - [Google Material Color implementation](https://github.com/danlevan/google-material-color) - [JQuery](http://jquery.com) diff --git a/app/BaseSoftDelete.php b/app/BaseSoftDelete.php index b7f7a6300..b28b297c0 100644 --- a/app/BaseSoftDelete.php +++ b/app/BaseSoftDelete.php @@ -10,9 +10,11 @@ abstract class BaseSoftDelete extends Model use SoftDeletes; /** - * The attributes that should be mutated to dates. + * The attributes that should be cast. * - * @var array + * @var array */ - protected $dates = ['deleted_at']; + protected $casts = [ + 'deleted_at' => 'datetime', + ]; } diff --git a/app/ClubEvent.php b/app/ClubEvent.php index 48e26c4fe..9969a58be 100644 --- a/app/ClubEvent.php +++ b/app/ClubEvent.php @@ -92,8 +92,13 @@ class ClubEvent extends Model 'canceled' ]; - protected $dates = [ - 'unlock_date', + /** + * The attributes that should be cast. + * + * @var array + */ + protected $casts = [ + 'unlock_date' => 'datetime', ]; diff --git a/app/Console/Commands/LDAPsync.php b/app/Console/Commands/LDAPsync.php index d210f6d72..72af806e3 100644 --- a/app/Console/Commands/LDAPsync.php +++ b/app/Console/Commands/LDAPsync.php @@ -2,7 +2,6 @@ namespace Lara\Console\Commands; -use Config; use Illuminate\Console\Command; use Lara\LdapPlatform; use Lara\Person; @@ -67,7 +66,7 @@ public function handle() // CONNECTING TO LDAP SERVER - $ldapConn = ldap_connect(Config::get('bcLDAP.server'), Config::get('bcLDAP.port')); + $ldapConn = ldap_connect(config('bcLDAP.server'), config('bcLDAP.port')); // Set some ldap options for talking to AD // LDAP_OPT_PROTOCOL_VERSION: LDAP protocol version @@ -77,8 +76,8 @@ public function handle() // Bind as a domain admin $ldap_bind = ldap_bind($ldapConn, - Config::get('bcLDAP.admin-username'), - Config::get('bcLDAP.admin-password')); + config('bcLDAP.admin-username'), + config('bcLDAP.admin-password')); $allowedSection = (new Section())->whereIn('title', ['bc-Club', 'bc-Café'])->get(); // STARTING THE UPDATE @@ -100,8 +99,8 @@ public function handle() // Search for a bc-Club user with the uid number entered $search = ldap_search($ldapConn, - Config::get('bcLDAP.bc-club-ou'). - Config::get('bcLDAP.base-dn'), + config('bcLDAP.bc-club-ou'). + config('bcLDAP.base-dn'), '(uid='.$person->prsn_ldap_id.')'); $info = ldap_get_entries($ldapConn, $search); @@ -113,8 +112,8 @@ public function handle() // Search for a Café-user with the uid number entered $search = ldap_search($ldapConn, - Config::get('bcLDAP.bc-cafe-ou'). - Config::get('bcLDAP.base-dn'), + config('bcLDAP.bc-cafe-ou'). + config('bcLDAP.base-dn'), '(uid='.$person->prsn_ldap_id.')'); $info = ldap_get_entries($ldapConn, $search); diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php index 02ee79525..13a51a330 100755 --- a/app/Http/Controllers/AdminController.php +++ b/app/Http/Controllers/AdminController.php @@ -8,7 +8,6 @@ namespace Lara\Http\Controllers; -use Redirect; use View; use Lara\Utilities; @@ -20,7 +19,7 @@ class AdminController extends Controller function startUpdateProcess(){ /** if you are no admin, you will be redirected back */ if(!Utilities::requirePermission('admin')){ - return Redirect::back($status = 403); + return back($status = 403); } return View::make('update'); } diff --git a/app/Http/Controllers/Auth/PasswordChangeController.php b/app/Http/Controllers/Auth/PasswordChangeController.php index 50b206aa6..732ebadf4 100644 --- a/app/Http/Controllers/Auth/PasswordChangeController.php +++ b/app/Http/Controllers/Auth/PasswordChangeController.php @@ -10,7 +10,6 @@ use Lara\User; use Lara\Utilities; use Lara\utilities\LdapUtility; -use Redirect; use Request; use Validator; use View; @@ -29,7 +28,7 @@ public function changePassword() // Get old password and check that it matches the one stored in the DB $validator = $this->validator($request->all()); if ($validator->fails()) { - return Redirect::back()->withErrors($validator)->withInput(); + return back()->withErrors($validator)->withInput(); } $oldPassword = $request->input('old-password'); @@ -39,7 +38,7 @@ public function changePassword() if (!$isPasswordCorrect) { Utilities::error(trans('auth.passwordDoesNotMatch')); - return Redirect::back(); + return back(); } $newPassword = $request->input('password'); @@ -56,7 +55,7 @@ public function changePassword() */ Utilities::success(trans('auth.passwordChanged')); - return Redirect::to('/'); + return redirect('/'); } public function validator($data) diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 06a9b7f51..780454406 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -101,7 +101,7 @@ public function register(Request $request) $this->authorize('create', User::class); - if (Gate::denies('createUserOfSection', $request->get('section'))) { + if (Gate::denies('createUserOfSection', $request->input('section'))) { Utilities::error('You cannot create a user of another section!'); return redirect($this->redirectPath()); } diff --git a/app/Http/Controllers/ClubEventController.php b/app/Http/Controllers/ClubEventController.php index 9b465421e..30ff21ba8 100644 --- a/app/Http/Controllers/ClubEventController.php +++ b/app/Http/Controllers/ClubEventController.php @@ -5,7 +5,6 @@ use Auth; use Cache; use Carbon\Carbon; -use Config; use DateInterval; use DateTime; use DateTimeZone; @@ -24,8 +23,7 @@ use Lara\Template; use Lara\Utilities; use Lara\utilities\RoleUtility; -use Redirect; -use Session; + use View; class ClubEventController extends Controller @@ -89,9 +87,9 @@ public function create($year = null, $month = null, $day = null, $templateId = n $isDateFormatValid = $d && $d->format('Y-m-d') === $dateString; if (!$isDateFormatValid) { - Session::put('message', trans("messages.invalidDate", compact('day', 'month', 'year'))); - Session::put('msgType', 'danger'); - return Redirect::to('/'); + session()->put('message', trans("messages.invalidDate", compact('day', 'month', 'year'))); + session()->put('msgType', 'danger'); + return redirect('/'); } // prepare correct date format to be used in the forms @@ -221,9 +219,9 @@ public function store(Request $request) { //validate passwords if ($request->input('password') != $request->input('passwordDouble')) { - Session::put('message', Config::get('messages_de.password-mismatch')); - Session::put('msgType', 'danger'); - return Redirect::back()->withInput(); + session()->put('message', config('messages_de.password-mismatch')); + session()->put('msgType', 'danger'); + return back()->withInput(); } $newEvent = $this->editClubEvent(null); @@ -245,7 +243,7 @@ public function store(Request $request) } // show new event - return Redirect::action('ClubEventController@show', [$newEvent->id]); + return redirect()->action([ClubEventController::class, 'show'], [$newEvent->id]); } /** @@ -265,14 +263,14 @@ public function show(ClubEvent $event) $user = Auth::user(); if (!$user && $clubEvent->evnt_is_private == 1) { - Session::put('message', Config::get('messages_de.access-denied')); - Session::put('msgType', 'danger'); - return Redirect::action( - 'MonthController@showMonth', - array( + session()->put('message', config('messages_de.access-denied')); + session()->put('msgType', 'danger'); + return redirect()->action( + [MonthController::class, 'showMonth'], + [ 'year' => date('Y'), 'month' => date('m') - ) + ] ); } @@ -451,9 +449,9 @@ public function update(Request $request, ClubEvent $event) { //validate passwords if ($request->input('password') != $request->input('passwordDouble')) { - Session::put('message', Config::get('messages_de.password-mismatch')); - Session::put('msgType', 'danger'); - return Redirect::back()->withInput(); + session()->put('message', config('messages_de.password-mismatch')); + session()->put('msgType', 'danger'); + return back()->withInput(); } $event = $this->editClubEvent($event); @@ -473,7 +471,7 @@ public function update(Request $request, ClubEvent $event) } // show event - return Redirect::action('ClubEventController@show', [$event->id]); + return redirect()->action([ClubEventController::class, 'show'], [$id]); } /** @@ -486,20 +484,28 @@ public function destroy(ClubEvent $event) { $date = new DateTime($event->evnt_date_start); + + // Check if event exists + if (is_null($event)) { + session()->put('message', config('messages_de.event-doesnt-exist')); + session()->put('msgType', 'danger'); + return back(); + } + // Check credentials: you can only delete, if you have rights for marketing or management. $revisions = json_decode($event->getSchedule->entry_revisions, true); $created_by = $revisions[0]["user id"]; $user = Auth::user(); if (!$user || !$user->isAn(RoleUtility::PRIVILEGE_MARKETING, RoleUtility::PRIVILEGE_CL, RoleUtility::PRIVILEGE_ADMINISTRATOR)) { - Session::put('message', 'Du darfst diese Veranstaltung/Aufgabe nicht einfach löschen! Frage die Clubleitung oder Markleting ;)'); - Session::put('msgType', 'danger'); - return Redirect::action( - 'MonthController@showMonth', - array( + session()->put('message', 'Du darfst diese Veranstaltung/Aufgabe nicht einfach löschen! Frage die Clubleitung oder Markleting ;)'); + session()->put('msgType', 'danger'); + return redirect()->action( + [MonthController::class, 'showMonth'], + [ 'year' => date('Y'), 'month' => date('m') - ) + ] ); } @@ -512,9 +518,9 @@ public function destroy(ClubEvent $event) $event->delete(); // show current month afterwards - Session::put('message', Config::get('messages_de.event-delete-ok')); - Session::put('msgType', 'success'); - return Redirect::action('MonthController@showMonth', [ + session()->put('message', config('messages_de.event-delete-ok')); + session()->put('msgType', 'success'); + return redirect()->action([MonthController::class, 'showMonth'], [ 'year' => $date->format('Y'), 'month' => $date->format('m') ]); @@ -574,14 +580,14 @@ private function editClubEvent(ClubEvent $event = null) // format: date; validate on filled value if (!empty(request('beginDate'))) { - $newBeginDate = new DateTime(request('beginDate'), new DateTimeZone(Config::get('app.timezone'))); + $newBeginDate = new DateTime(request('beginDate'), new DateTimeZone(config('app.timezone'))); $event->evnt_date_start = $newBeginDate->format('Y-m-d'); } else { $event->evnt_date_start = date('Y-m-d', mktime(0, 0, 0, 0, 0, 0));; } if (!empty(request('endDate'))) { - $newEndDate = new DateTime(request('endDate'), new DateTimeZone(Config::get('app.timezone'))); + $newEndDate = new DateTime(request('endDate'), new DateTimeZone(config('app.timezone'))); $event->evnt_date_end = $newEndDate->format('Y-m-d'); } else { $event->evnt_date_end = date('Y-m-d', mktime(0, 0, 0, 0, 0, 0));; diff --git a/app/Http/Controllers/DateController.php b/app/Http/Controllers/DateController.php index b98b6ae39..bdcfd2745 100644 --- a/app/Http/Controllers/DateController.php +++ b/app/Http/Controllers/DateController.php @@ -4,7 +4,6 @@ use Carbon\Carbon; use Request; -use Redirect; use View; use Lara\Http\Requests; @@ -25,7 +24,8 @@ class DateController extends Controller { */ public function currentDate() { - return Redirect::action( 'DateController@showDate', ['year' => date("Y"), + return redirect()->action( [DateController::class,'showDate'], + ['year' => date("Y"), 'month' => date("m"), 'day' => date("d")] ); } diff --git a/app/Http/Controllers/IcalController.php b/app/Http/Controllers/IcalController.php index eb7450dbf..b85679b8e 100644 --- a/app/Http/Controllers/IcalController.php +++ b/app/Http/Controllers/IcalController.php @@ -26,8 +26,7 @@ use Lara\Utilities; use Lara\utilities\RoleUtility; use Log; -use Redirect; -use Session; + use URL; /** Controller for generating iCal feeds */ @@ -500,11 +499,11 @@ public function togglePublishState($id) $user = Auth::user(); if (!$user || !$user->isAn(RoleUtility::PRIVILEGE_MARKETING, RoleUtility::PRIVILEGE_ADMINISTRATOR, RoleUtility::PRIVILEGE_CL)) { - Session::put( + session()->put( 'message', 'Du darfst dieses Event nicht veröffentlichen! Frage die Clubleitung oder Markleting ;)' ); - Session::put('msgType', 'danger'); + session()->put('msgType', 'danger'); return back(); } @@ -521,8 +520,8 @@ public function togglePublishState($id) . ') unpublished event "' . $event->evnt_title . '" (eventID: ' . $event->id . ') on ' . $event->evnt_date_start . '.'); // Inform the user - Session::put('message', "Dieses Event wurde erfolgreich aus dem Kalenderfeed entfernt."); - Session::put('msgType', 'danger'); + session()->put('message', "Dieses Event wurde erfolgreich aus dem Kalenderfeed entfernt."); + session()->put('msgType', 'danger'); return back(); @@ -538,8 +537,8 @@ public function togglePublishState($id) . $user->roles()->get(['name']) . ') published event "' . $event->evnt_title . '" (eventID: ' . $event->id . ') on ' . $event->evnt_date_start . '.'); // Inform the user - Session::put('message', "Dieses Event wurde erfolgreich zum Kalenderfeed hinzugefügt."); - Session::put('msgType', 'success'); + session()->put('message', "Dieses Event wurde erfolgreich zum Kalenderfeed hinzugefügt."); + session()->put('msgType', 'success'); return back(); } diff --git a/app/Http/Controllers/LanguageController.php b/app/Http/Controllers/LanguageController.php index 7eb670503..24e5461dc 100755 --- a/app/Http/Controllers/LanguageController.php +++ b/app/Http/Controllers/LanguageController.php @@ -4,9 +4,6 @@ use Auth; -use Config; -use Redirect; -use Session; use Lara\Settings; @@ -14,8 +11,8 @@ class LanguageController extends Controller { public function switchLang($lang) { - if (array_key_exists($lang, Config::get('languages'))) { - Session::put('language', $lang); + if (array_key_exists($lang, config('languages'))) { + session(['language' => $lang]); $user = Auth::user(); if ($user) { @@ -31,6 +28,6 @@ public function switchLang($lang) } } - return Redirect::back(); + return back(); } } diff --git a/app/Http/Controllers/LegalController.php b/app/Http/Controllers/LegalController.php index 1c7e5bfd9..aee0e333c 100644 --- a/app/Http/Controllers/LegalController.php +++ b/app/Http/Controllers/LegalController.php @@ -3,7 +3,6 @@ namespace Lara\Http\Controllers; use Illuminate\Http\Request; -use Redirect; use View; class LegalController extends Controller @@ -15,6 +14,6 @@ public function showPrivacyPolicy() { // Generate a page for impressum public function showImpressum() { // Will redirect to ILSC Impressum for now, might need to create own page later - return redirect()->to("http://www.il-sc.de/impressum"); + return redirect("http://www.il-sc.de/impressum"); } } diff --git a/app/Http/Controllers/LoginController.php b/app/Http/Controllers/LoginController.php index 4781b5f90..dc8ae7c43 100755 --- a/app/Http/Controllers/LoginController.php +++ b/app/Http/Controllers/LoginController.php @@ -2,7 +2,6 @@ namespace Lara\Http\Controllers; -use Config; use Illuminate\Foundation\Auth\AuthenticatesUsers; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; @@ -17,7 +16,7 @@ use Lara\Utilities; use Lara\utilities\RoleUtility; use Log; -use Session; + /* -------------------------------------------------------------------------- @@ -57,7 +56,7 @@ class LoginController extends Controller */ public function doLogout() { - Session::flush(); + session()->flush(); if (Auth::user()) { return $this->logout( request()); } @@ -190,8 +189,8 @@ protected function attemptLoginViaLDAP(Request $request) protected function attemptLoginViaLDAPInternal(Request $request) { if ($request->input('username') === "1708") { - Session::put('message', 'Ne ne ne, nicht mit dieser Clubnummer, sie ist ja nur fur bc-Wiki zu benutzen ;)'); - Session::put('msgType', 'danger'); + session()->put('message', 'Ne ne ne, nicht mit dieser Clubnummer, sie ist ja nur fur bc-Wiki zu benutzen ;)'); + session()->put('msgType', 'danger'); Log::warning('bc-Wiki login used (1708), access denied.'); @@ -199,7 +198,7 @@ protected function attemptLoginViaLDAPInternal(Request $request) } // CONNECTING TO LDAP SERVER - $ldapConn = ldap_connect(Config::get('bcLDAP.server'), Config::get('bcLDAP.port')); + $ldapConn = ldap_connect(config('bcLDAP.server'), config('bcLDAP.port')); // Set some ldap options for talking to AD // LDAP_OPT_PROTOCOL_VERSION: LDAP protocol version @@ -209,8 +208,8 @@ protected function attemptLoginViaLDAPInternal(Request $request) // Bind as a domain admin $ldap_bind = ldap_bind($ldapConn, - Config::get('bcLDAP.admin-username'), - Config::get('bcLDAP.admin-password')); + config('bcLDAP.admin-username'), + config('bcLDAP.admin-password')); // INPUT VALIDATION AND ERROR HANDLING @@ -237,8 +236,8 @@ protected function attemptLoginViaLDAPInternal(Request $request) // Search for a bc-Club user with the uid number entered $search = ldap_search($ldapConn, - Config::get('bcLDAP.bc-club-ou') . - Config::get('bcLDAP.base-dn'), + config('bcLDAP.bc-club-ou') . + config('bcLDAP.base-dn'), '(uid=' . $request->input('username') . ')'); $info = ldap_get_entries($ldapConn, $search); @@ -257,8 +256,8 @@ protected function attemptLoginViaLDAPInternal(Request $request) // Search for a Café-user with the uid number entered $search = ldap_search($ldapConn, - Config::get('bcLDAP.bc-cafe-ou') . - Config::get('bcLDAP.base-dn'), + config('bcLDAP.bc-cafe-ou') . + config('bcLDAP.base-dn'), '(uid=' . $request->input('username') . ')'); $info = ldap_get_entries($ldapConn, $search); @@ -277,8 +276,8 @@ protected function attemptLoginViaLDAPInternal(Request $request) if ($info['count'] === 0) { ldap_unbind($ldapConn); - Session::put('message', Config::get('messages_de.uid-not-found')); - Session::put('msgType', 'danger'); + session()->put('message', config('messages_de.uid-not-found')); + session()->put('msgType', 'danger'); Log::info('Auth fail: wrong userID given (username: ' . $request->input('username') . ').'); @@ -295,9 +294,9 @@ protected function attemptLoginViaLDAPInternal(Request $request) if ($userGroup === "bc-Club") { // Check if user has MARKETING rights in bc-CLub $searchGroup = ldap_search($ldapConn, - Config::get('bcLDAP.bc-club-group-ou') . - Config::get('bcLDAP.base-dn'), - Config::get('bcLDAP.bc-club-marketing-group')); + config('bcLDAP.bc-club-group-ou') . + config('bcLDAP.base-dn'), + config('bcLDAP.bc-club-marketing-group')); $infoGroup = ldap_get_entries($ldapConn, $searchGroup); @@ -310,9 +309,9 @@ protected function attemptLoginViaLDAPInternal(Request $request) // Check if user has MANAGEMENT rights in bc-CLub $searchGroup = ldap_search($ldapConn, - Config::get('bcLDAP.bc-club-group-ou') . - Config::get('bcLDAP.base-dn'), - Config::get('bcLDAP.bc-club-management-group')); + config('bcLDAP.bc-club-group-ou') . + config('bcLDAP.base-dn'), + config('bcLDAP.bc-club-management-group')); $infoGroup = ldap_get_entries($ldapConn, $searchGroup); @@ -324,9 +323,9 @@ protected function attemptLoginViaLDAPInternal(Request $request) } elseif ($userGroup === "bc-Café") { // Check if user has MARKETING rights in bc-Café $searchGroup = ldap_search($ldapConn, - Config::get('bcLDAP.bc-cafe-group-ou') . - Config::get('bcLDAP.base-dn'), - Config::get('bcLDAP.bc-cafe-marketing-group')); + config('bcLDAP.bc-cafe-group-ou') . + config('bcLDAP.base-dn'), + config('bcLDAP.bc-cafe-marketing-group')); $infoGroup = ldap_get_entries($ldapConn, $searchGroup); @@ -339,9 +338,9 @@ protected function attemptLoginViaLDAPInternal(Request $request) // Check if user has MANAGEMENT rights in bc-Café $searchGroup = ldap_search($ldapConn, - Config::get('bcLDAP.bc-cafe-group-ou') . - Config::get('bcLDAP.base-dn'), - Config::get('bcLDAP.bc-cafe-management-group')); + config('bcLDAP.bc-cafe-group-ou') . + config('bcLDAP.base-dn'), + config('bcLDAP.bc-cafe-management-group')); $infoGroup = ldap_get_entries($ldapConn, $searchGroup); @@ -357,7 +356,7 @@ protected function attemptLoginViaLDAPInternal(Request $request) // Checks if user LDAP ID is among hardcoded admin LDAP IDs from the config file - if (in_array($info[0]['uidnumber'][0], Config::get('bcLDAP.admin-ldap-id'))) { + if (in_array($info[0]['uidnumber'][0], config('bcLDAP.admin-ldap-id'))) { $userGroup = "admin"; } @@ -483,7 +482,7 @@ protected function attemptLoginWithCredentials($request, $userIdentifier = 'emai */ protected function loginFailed() { - Utilities::error(Config::get('messages_de.login-fail')); + Utilities::error(config('messages_de.login-fail')); $this->incrementLoginAttempts(request()); return redirect()->back()->withInput(request()->all()); } diff --git a/app/Http/Controllers/MonthController.php b/app/Http/Controllers/MonthController.php index 254899b52..0c3d7bda2 100644 --- a/app/Http/Controllers/MonthController.php +++ b/app/Http/Controllers/MonthController.php @@ -10,7 +10,6 @@ use Lara\Section; use Lara\Survey; use Lara\utilities\CacheUtility; -use Redirect; use View; @@ -31,7 +30,7 @@ public function __construct() */ public function currentMonth() { - return Redirect::action('MonthController@showMonth', [ + return redirect()->action([MonthController::class, 'showMonth'], [ 'year' => date("Y"), 'month' => date('m'), ]); diff --git a/app/Http/Controllers/PersonController.php b/app/Http/Controllers/PersonController.php index 010721ccd..284099980 100644 --- a/app/Http/Controllers/PersonController.php +++ b/app/Http/Controllers/PersonController.php @@ -6,10 +6,8 @@ use Cache; use DateTime; use DateInterval; -use Session; -use Config; + use Auth; -use Redirect; use Lara\Person; @@ -29,9 +27,9 @@ public function index( $query = NULL ) $user = Auth::user(); if(!$user) { - Session::put('message', Config::get('messages_de.access-denied')); - Session::put('msgType', 'danger'); - return Redirect::action('MonthController@showMonth', ['year' => date("Y"), 'month' => date('m')]); + session()->put('message', config('messages_de.access-denied')); + session()->put('msgType', 'danger'); + return redirect()->action([MonthController::class, 'showMonth'], ['year' => date("Y"), 'month' => date('m')]); } // if no parameter specified - empty means "show all" diff --git a/app/Http/Controllers/ScheduleController.php b/app/Http/Controllers/ScheduleController.php index f500dc58d..6e1969a87 100644 --- a/app/Http/Controllers/ScheduleController.php +++ b/app/Http/Controllers/ScheduleController.php @@ -4,7 +4,7 @@ use DateTime; use Request; -use Session; + use Input; use Hash; use Lara\Logging; @@ -126,9 +126,9 @@ public function destroy($id) // Check if the schedule exists if ( is_null($schedule) ) { - Session::put('message', 'Fehler: Löschvorgang abgebrochen - der Dienstplaneintrag existiert nicht.'); - Session::put('msgType', 'danger'); - return Redirect::back(); + session()->put('message', 'Fehler: Löschvorgang abgebrochen - der Dienstplaneintrag existiert nicht.'); + session()->put('msgType', 'danger'); + return back(); } // Delete all corresponding shifts first because of dependencies in database foreach ( $schedule->shifts as $shift ) { diff --git a/app/Http/Controllers/SecondFactorController.php b/app/Http/Controllers/SecondFactorController.php index 53d721d40..09a4e4d8c 100644 --- a/app/Http/Controllers/SecondFactorController.php +++ b/app/Http/Controllers/SecondFactorController.php @@ -7,7 +7,6 @@ use Lara\Http\Middleware\RejectGuests; use PragmaRX\Google2FA\Google2FA; -use Redirect; class SecondFactorController extends Controller { @@ -32,9 +31,9 @@ public function verify() 'code' => 'required|digits:6' ]); if ($validator->fails()) { - return Redirect::back()->withErrors($validator->errors()); + return back()->withErrors($validator->errors()); } - $targeturl = \Session::get('targeturl', "/"); + $targeturl = session('targeturl', "/"); if (is_array($targeturl)) { $targeturl = $targeturl[0]; } @@ -43,14 +42,14 @@ public function verify() $secret = \Auth::user()->google2fa_secret; try { if ($google2fa->verify($request->input("code"), $secret)) { - \Session::forget('targeturl'); - \Session::put('2faVeryfied', true); - return Redirect::to($targeturl); + session()->forget('targeturl'); + session()->put('2faVeryfied', true); + return redirect($targeturl); } else { - return Redirect::back()->withErrors(['code' => 'invalid code']); + return back()->withErrors(['code' => 'invalid code']); } } catch (\Exception $e) { - return Redirect::back()->withErrors(['code' => $e->getMessage()]); + return back()->withErrors(['code' => $e->getMessage()]); } } diff --git a/app/Http/Controllers/SectionController.php b/app/Http/Controllers/SectionController.php index 164ca2f13..a08c7f370 100644 --- a/app/Http/Controllers/SectionController.php +++ b/app/Http/Controllers/SectionController.php @@ -16,9 +16,8 @@ use Lara\Utilities; use Lara\ClubEvent; use Lara\utilities\RoleUtility; -use Session; + use View; -use Redirect; use Log; class SectionController extends Controller @@ -27,7 +26,7 @@ class SectionController extends Controller public function __construct() { $this->middleware(ClOnly::class); - $this->middleware(AdminOnly::class,['only' => ['create','destroy']]); + $this->middleware(AdminOnly::class, ['only' => ['create', 'destroy']]); } @@ -39,11 +38,11 @@ public function __construct() public function index() { /** if you are an admin, you can see all */ - if(Auth::user()->isAn(RoleUtility::PRIVILEGE_ADMINISTRATOR)) { + if (Auth::user()->isAn(RoleUtility::PRIVILEGE_ADMINISTRATOR)) { $sections = Section::query()->orderBy('title', 'ASC')->get(); } else { /** if you are just an CL you can only edit the section where you have the permissions */ - $sections = Auth::user()->roles()->where('name','=',RoleUtility::PRIVILEGE_CL)->get()->map(function (Role $role){ + $sections = Auth::user()->roles()->where('name', '=', RoleUtility::PRIVILEGE_CL)->get()->map(function (Role $role) { return $role->section; })->unique(); } @@ -59,7 +58,7 @@ public function index() public function create() { $current_section = new Section(); - $current_section->title= trans('mainLang.newSection'); + $current_section->title = trans('mainLang.newSection'); return View::make('sectionView', compact('current_section')); } @@ -88,16 +87,16 @@ public function store(Request $request) if ($validator->fails()) { - return Redirect::back()->withErrors($validator)->withInput($request->all()); + return back()->withErrors($validator)->withInput($request->all()); } if ($isNew) { $existingSection = (new Section)->where('title', '=', $title)->first(); if (!is_null($existingSection)) { // Return to the section management page - Session::put('message', trans('mainLang.sectionExists')); - Session::put('msgType', 'danger'); - return Redirect::back(); + session()->put('message', trans('mainLang.sectionExists')); + session()->put('msgType', 'danger'); + return back(); } $section = new Section(); $section->section_uid = hash("sha512", uniqid()); @@ -107,12 +106,12 @@ public function store(Request $request) $existingSection = Section::where('title', '=', $title)->where('id', '!=', $id)->first(); if (!is_null($existingSection)) { // Return to the section management page - Session::put('message', trans('mainLang.sectionExists')); - Session::put('msgType', 'danger'); - return Redirect::back(); + session()->put('message', trans('mainLang.sectionExists')); + session()->put('msgType', 'danger'); + return back(); } - $club = Club::where('clb_title','=',$section->title)->first(); - if(is_null($club)){ + $club = Club::where('clb_title', '=', $section->title)->first(); + if (is_null($club)) { $club = new Club(); } } @@ -132,9 +131,9 @@ public function store(Request $request) $club->save(); // Return to the the section management page - Session::put('message', trans('mainLang.changesSaved')); - Session::put('msgType', 'success'); - return Redirect::action( 'SectionController@index' ); + session()->put('message', trans('mainLang.changesSaved')); + session()->put('msgType', 'success'); + return redirect()->action([SectionController::class, 'index']); } /** @@ -185,7 +184,7 @@ public function destroy(Section $section) // Log the action while we still have the data /** @var User $user */ $user = Auth::user(); - $userGroups = $user->roles()->get()->map(function(Role $role){ + $userGroups = $user->roles()->get()->map(function (Role $role) { return $role->name; })->toArray(); $person = $user->person; @@ -197,7 +196,7 @@ public function destroy(Section $section) $events = (new \Lara\ClubEvent)->where("plc_id", "=", $section->id)->get(); /* @var $event ClubEvent */ foreach ($events as $event) { - // Delete schedule with shifts + // Delete schedule with shifts (new ScheduleController)->destroy($event->getSchedule()->first()->id); // Now delete the event itself @@ -205,8 +204,8 @@ public function destroy(Section $section) } //find according clubs - $clubs= (new Club)->where('clb_title','=',$section->title)->get(); - foreach ($clubs as $club){ + $clubs = (new Club)->where('clb_title', '=', $section->title)->get(); + foreach ($clubs as $club) { Club::destroy($club->id); } @@ -214,7 +213,7 @@ public function destroy(Section $section) try { (new Role())->where('section_id', '=', $section->id)->delete(); } catch (\Exception $e) { - Log::error('cannot delete roles',[$e]); + Log::error('cannot delete roles', [$e]); } $templates = $section->templates; @@ -227,8 +226,8 @@ public function destroy(Section $section) Section::destroy($section->id); // Return to the management page - Session::put('message', trans('mainLang.changesSaved')); - Session::put('msgType', 'success'); - return Redirect::action( 'SectionController@index' ); + session()->put('message', trans('mainLang.changesSaved')); + session()->put('msgType', 'success'); + return redirect()->action([SectionController::class, 'index']); } } diff --git a/app/Http/Controllers/ShiftController.php b/app/Http/Controllers/ShiftController.php index 3a6970303..b75ec3b5b 100644 --- a/app/Http/Controllers/ShiftController.php +++ b/app/Http/Controllers/ShiftController.php @@ -15,7 +15,7 @@ use Lara\Status; use Lara\Utilities; use Lara\utilities\RoleUtility; -use Session; + class ShiftController extends Controller { @@ -67,22 +67,22 @@ public function show($id) public function update(Request $request, $id) { // Check if it's our form (CSRF protection) - if (Session::token() !== $request->input('_token')) { + if (session()->token() !== $request->input('_token')) { return response()->json(["errorCode" => 'sessionExpired'], 401); } Utilities::clearIcalCache(); // If we only want to modify the shiftType via management pages - do it without evaluating the rest - if (!empty($request->get('shiftTypeId')) && is_numeric($request->get('shiftTypeId'))) { + if (!empty($request->input('shiftTypeId')) && is_numeric($request->input('shiftTypeId'))) { // Find the corresponding shift object /** @var Shift $shift */ - $shift = Shift::query()->where('id', '=', $request->get('entryId'))->with('schedule')->with('schedule.event') + $shift = Shift::query()->where('id', '=', $request->input('entryId'))->with('schedule')->with('schedule.event') ->first(); // Substitute values - $shift->shifttype_id = $request->get('shiftTypeId'); + $shift->shifttype_id = $request->input('shiftTypeId'); $shift->save(); // Log changes @@ -96,13 +96,13 @@ public function update(Request $request, $id) } // Extract request data - $shiftId = $request->get('entryId'); - $userName = $request->get('userName'); - $ldapId = $request->get('ldapId'); - $timestamp = $request->get('timestamp'); - $userClub = $request->get('userClub'); - $userComment = $request->get('userComment'); - $password = $request->get('password'); + $shiftId = $request->input('entryId'); + $userName = $request->input('userName'); + $ldapId = $request->input('ldapId'); + $timestamp = $request->input('timestamp'); + $userClub = $request->input('userClub'); + $userComment = $request->input('userComment'); + $password = $request->input('password'); // Check if someone modified LDAP ID manually if (!empty($ldapId) && !is_numeric($ldapId)) { @@ -291,9 +291,9 @@ public static function delete($shift) // Check if shift exists if (is_null($shift)) { - Session::put('message', 'Fehler: Löschvorgang abgebrochen - der Dienstplaneintrag existiert nicht.'); - Session::put('msgType', 'danger'); - return Redirect::back(); + session()->put('message', 'Fehler: Löschvorgang abgebrochen - der Dienstplaneintrag existiert nicht.'); + session()->put('msgType', 'danger'); + return back(); } Utilities::clearIcalCache(); diff --git a/app/Http/Controllers/ShiftTypeController.php b/app/Http/Controllers/ShiftTypeController.php index 8e6e447e7..c938f6157 100644 --- a/app/Http/Controllers/ShiftTypeController.php +++ b/app/Http/Controllers/ShiftTypeController.php @@ -14,8 +14,7 @@ use Lara\Utilities; use Lara\utilities\RoleUtility; use Log; -use Redirect; -use Session; + use View; @@ -118,41 +117,41 @@ public function update(Request $request, $id) // Check credentials: you can only edit, if you have rights for marketing, section management or admin $user = Auth::user(); - if(!$user || !$user->isAn(['marketing', 'clubleitung', 'admin'])) + if(!$user || !$user->isAn(RoleUtility::PRIVILEGE_MARKETING, RoleUtility::PRIVILEGE_CL, RoleUtility::PRIVILEGE_ADMINISTRATOR)) { - Session::put('message', trans('mainLang.cantTouchThis')); - Session::put('msgType', 'danger'); - return Redirect::back(); + session()->put('message', trans('mainLang.cantTouchThis')); + session()->put('msgType', 'danger'); + return back(); } // Get all the data (throws a 404 error if shiftType doesn't exist) $shiftType = ShiftType::findOrFail($id); // Extract request data - $newTitle = $request->get('title'.$id); - $newTimeStart = $request->get('start'.$id); - $newTimeEnd = $request->get('end'.$id); - $newWeight = $request->get('statistical_weight'.$id); + $newTitle = $request->input('title'.$id); + $newTimeStart = $request->input('start'.$id); + $newTimeEnd = $request->input('end'.$id); + $newWeight = $request->input('statistical_weight'.$id); // Check for empty values if (empty($newTitle) || empty($newTimeStart) || empty($newTimeEnd)) { - Session::put('message', trans('mainLang.cantBeBlank')); - Session::put('msgType', 'danger'); - return Redirect::back(); + session()->put('message', trans('mainLang.cantBeBlank')); + session()->put('msgType', 'danger'); + return back(); } // Statistical weight must be numerical if (!is_numeric($newWeight)) { - Session::put('message', trans('mainLang.nonNumericStats')); - Session::put('msgType', 'danger'); - return Redirect::back(); + session()->put('message', trans('mainLang.nonNumericStats')); + session()->put('msgType', 'danger'); + return back(); } // Statistical weight must be non-negative if ($newWeight < 0.0) { - Session::put('message', trans('mainLang.negativeStats')); - Session::put('msgType', 'danger'); - return Redirect::back(); + session()->put('message', trans('mainLang.negativeStats')); + session()->put('msgType', 'danger'); + return back(); } // Log the action while we still have the data @@ -168,9 +167,9 @@ public function update(Request $request, $id) $shiftType->save(); // Return to the shiftType page - Session::put('message', trans('mainLang.changesSaved')); - Session::put('msgType', 'success'); - return Redirect::back(); + session()->put('message', trans('mainLang.changesSaved')); + session()->put('msgType', 'success'); + return back(); } /** @@ -185,7 +184,7 @@ public function overrideShiftType(Request $request) $shiftTypeNewId = $request->input('shiftType'); $this->replaceShiftType($shiftId, $shiftTypeNewId); - return Redirect::back(); + return back(); } @@ -235,7 +234,7 @@ public function completeOverrideShiftType(Request $request) $shifts->each(function ($shift) use ($shiftTypeNewId) { $this->replaceShiftType($shift->id, $shiftTypeNewId); }); - return Redirect::back(); + return back(); } /** @@ -249,11 +248,11 @@ public function destroy($id) // Check credentials: you can only delete, if you have rights for marketing, section management or admin $user = Auth::user(); - if(!$user || !$user->is(['marketing', 'clubleitung', 'admin'])) + if(!$user || !$user->isAn(RoleUtility::PRIVILEGE_MARKETING, RoleUtility::PRIVILEGE_CL, RoleUtility::PRIVILEGE_ADMINISTRATOR)) { - Session::put('message', trans('mainLang.cantTouchThis')); - Session::put('msgType', 'danger'); - return Redirect::back(); + session()->put('message', trans('mainLang.cantTouchThis')); + session()->put('msgType', 'danger'); + return back(); } // Get all the data @@ -265,9 +264,9 @@ public function destroy($id) // CASE 1: job type still in use - let the user decide what to do in each case // Inform the user about the redirect and go to detailed info about the job type selected - Session::put('message', trans('mainLang.deleteFailedShiftTypeInUse')); - Session::put('msgType', 'danger'); - return Redirect::action( 'ShiftTypeController@show', [ $shiftType->id] ); + session()->put('message', trans('mainLang.deleteFailedShiftTypeInUse')); + session()->put('msgType', 'danger'); + return redirect()->action([ShiftTypeController::class, 'show'], [ $shiftType->id] ); } else { @@ -282,9 +281,9 @@ public function destroy($id) ShiftType::destroy($id); // Return to the management page - Session::put('message', trans('mainLang.changesSaved')); - Session::put('msgType', 'success'); - return Redirect::action( 'ShiftTypeController@index' ); + session()->put('message', trans('mainLang.changesSaved')); + session()->put('msgType', 'success'); + return redirect()->action([ShiftTypeController::class, 'show']); } } @@ -304,12 +303,12 @@ private function replaceShiftType($shiftId, $shiftTypeNewId) $shift->statistical_weight = $shiftType->statistical_weight; $shift->save(); - Session::put('message', trans('mainLang.changesSaved')); - Session::put('msgType', 'success'); + session()->put('message', trans('mainLang.changesSaved')); + session()->put('msgType', 'success'); } catch (\Exception $e) { Log::error('error', [$e]); - Session::put('message', trans('mainLang.error')); - Session::put('msgType', 'danger'); + session()->put('message', trans('mainLang.error')); + session()->put('msgType', 'danger'); } } } diff --git a/app/Http/Controllers/StatisticsController.php b/app/Http/Controllers/StatisticsController.php index c9b6187fe..143ca5314 100644 --- a/app/Http/Controllers/StatisticsController.php +++ b/app/Http/Controllers/StatisticsController.php @@ -10,7 +10,6 @@ use Lara\Person; use Lara\Shift; use Lara\StatisticsInformation; -use Redirect; use View; class StatisticsController extends Controller @@ -158,7 +157,7 @@ public function shiftsByPerson($id = null) { // fill empty parameters - no date selected means show current month and year if (!isset($id)) { - return Redirect::action('StatisticsController@showStatistics'); + return redirect()->action([StatisticsController::class, 'showStatistics']); } request("year") ? $year = request("year") : $year = strftime('%Y'); request("month") ? $month = request("month") : $month = strftime('%m'); diff --git a/app/Http/Controllers/SurveyAnswerController.php b/app/Http/Controllers/SurveyAnswerController.php index 915981226..c3f61aa5c 100644 --- a/app/Http/Controllers/SurveyAnswerController.php +++ b/app/Http/Controllers/SurveyAnswerController.php @@ -12,8 +12,7 @@ use Lara\Survey; use Lara\SurveyAnswer; use Lara\SurveyAnswerCell; -use Redirect; -use Session; + /** @@ -50,9 +49,9 @@ public function store($surveyid, Request $input) //check if survey needs a password and validate hashes if ($survey->password !== '' && !Hash::check($input->password, $survey->password)) { - Session::put('message', 'Fehler: das angegebene Passwort ist falsch, keine Änderungen wurden gespeichert. Bitte versuche es erneut oder frage ein anderes Mitglied oder CL.'); - Session::put('msgType', 'danger'); - return Redirect::action('SurveyController@show', [$survey->id]); + session()->put('message', 'Fehler: das angegebene Passwort ist falsch, keine Änderungen wurden gespeichert. Bitte versuche es erneut oder frage ein anderes Mitglied oder CL.'); + session()->put('msgType', 'danger'); + return redirect()->action([SurveyController::class, 'show'], [$survey->id]); } $survey_answer = new SurveyAnswer(); @@ -103,10 +102,10 @@ public function store($surveyid, Request $input) $survey_answer_cell->save(); $revision_cell->save($survey_answer_cell); } - Session::put('message', 'Erfolgreich abgestimmt!'); - Session::put('msgType', 'success'); + session()->put('message', 'Erfolgreich abgestimmt!'); + session()->put('msgType', 'success'); - return Redirect::action('SurveyController@show', [$survey->id]); + return redirect()->action([SurveyController::class, 'show'], [$survey->id]); } /** @@ -120,7 +119,7 @@ public function update($surveyid, $answerid) /** @var Request $input */ $input = request(); //validate session token - if (Session::token() !== $input->get('_token')) { + if (session()->token() !== $input->get('_token')) { return response()->json('Fehler: die Session ist abgelaufen. Bitte aktualisiere die Seite und logge dich ggf. erneut ein.', 401); } @@ -201,9 +200,9 @@ public function destroy($surveyid, $id, Request $input) $survey = Survey::findOrFail($surveyid); if ($survey->password !== '' && !Hash::check($input->password, $survey->password)) { - Session::put('message', 'Fehler: das eingegebene Passwort war leider falsch.'); - Session::put('msgType', 'error'); - return Redirect::action('SurveyController@show', [$surveyid]); + session()->put('message', 'Fehler: das eingegebene Passwort war leider falsch.'); + session()->put('msgType', 'error'); + return redirect()->action([SurveyController::class, 'show'], [$surveyid]); } $answer = SurveyAnswer::findOrFail($id); $revision_answer = new Revision($answer); @@ -219,10 +218,10 @@ public function destroy($surveyid, $id, Request $input) $answer->delete(); $revision_answer->save($answer, "Antwort gelöscht"); - Session::put('message', 'Erfolgreich gelöscht!'); - Session::put('msgType', 'success'); + session()->put('message', 'Erfolgreich gelöscht!'); + session()->put('msgType', 'success'); - return Redirect::action('SurveyController@show', [ $surveyid ]); + return redirect()->action([SurveyController::class, 'show'], [ $surveyid ]); } /* diff --git a/app/Http/Controllers/SurveyController.php b/app/Http/Controllers/SurveyController.php index 04c7020ac..190dc2192 100644 --- a/app/Http/Controllers/SurveyController.php +++ b/app/Http/Controllers/SurveyController.php @@ -3,7 +3,6 @@ namespace Lara\Http\Controllers; use Auth; -use Config; use Illuminate\Http\Request; use Hash; use Lara\Library\Revision; @@ -12,10 +11,7 @@ use Lara\SurveyAnswerCell; use Lara\Utilities; use Lara\utilities\RoleUtility; -use Session; -use Redirect; use DateTime; - use Lara\Survey; use Lara\QuestionType; use Lara\SurveyQuestion; @@ -96,7 +92,7 @@ public function store(SurveyRequest $request) SurveyQuestion::make($survey, $order, $question, $type, $isRequired, $options); } - return Redirect::action('SurveyController@show', [$survey->id]); + return redirect()->action([SurveyController::class, 'show'], [$survey->id]); } @@ -128,10 +124,10 @@ public function destroy($id) Revision::deleteWithRevision($survey); - Session::put('message', 'Umfrage gelöscht!'); - Session::put('msgType', 'success'); + session()->put('message', 'Umfrage gelöscht!'); + session()->put('msgType', 'success'); - return Redirect::action('MonthController@currentMonth'); + return redirect()->action([MonthController::class, 'currentMonth']); } /** @@ -148,9 +144,9 @@ public function show($id) $user = Auth::user(); if (!$user && $survey->is_private == 1) { - Session::put('message', Config::get('messages_de.access-denied')); - Session::put('msgType', 'danger'); - return Redirect::action('MonthController@showMonth', array('year' => date('Y'), + session()->put('message', config('messages_de.access-denied')); + session()->put('msgType', 'danger'); + return redirect()->action([MonthController::class, 'showMonth'], array('year' => date('Y'), 'month' => date('m'))); } @@ -523,7 +519,7 @@ public function update($id, SurveyRequest $request) $questionRevision->save($questionToModify); } - return Redirect::action('SurveyController@show', [ $survey->id ]); + return redirect()->action([SurveyController::class, 'show'], [ $survey->id ]); } diff --git a/app/Http/Controllers/TemplateController.php b/app/Http/Controllers/TemplateController.php index 0ee56081b..ddbc9d395 100644 --- a/app/Http/Controllers/TemplateController.php +++ b/app/Http/Controllers/TemplateController.php @@ -18,7 +18,7 @@ use Lara\Template; use Lara\Utilities; use Lara\utilities\RoleUtility; -use Session; + class TemplateController extends Controller { @@ -224,8 +224,8 @@ public function destroy($templateId) } $template->delete(); - Session::put('message', trans("mainLang.messageSuccessfulDeleted")); - Session::put('msgType', 'success'); + session()->put('message', trans("mainLang.messageSuccessfulDeleted")); + session()->put('msgType', 'success'); return redirect()->route('template.overview'); } diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 05365ea10..c261bde26 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -18,8 +18,6 @@ use Lara\Utilities; use Lara\utilities\RoleUtility; use Log; -use Redirect; -use Session; use View; class UserController extends Controller @@ -151,7 +149,7 @@ public function update(Request $request, User $user) if (!Auth::user()->can('update', $user)) { Utilities::error(trans('mainLang.accessDenied')); - return Redirect::back(); + return back(); } $user->fill($request->all())->save(); @@ -163,7 +161,7 @@ public function update(Request $request, User $user) Utilities::success(trans('mainLang.update')); - return Redirect::back(); + return back(); } /** @@ -180,7 +178,7 @@ public function destroy($id) if ($user->id == \Auth::user()->id) { Utilities::error(trans('mainLang.accessDenied')); - return Redirect::back(); + return back(); } $person = $user->person; $person->prsn_ldap_id = null; @@ -204,7 +202,7 @@ public function destroy($id) Log::info('User: '.\Auth::user()->name.' deleted '.$user->name); Utilities::success(trans('mainLang.changesSaved')); - return Redirect::action('UserController@index'); + return redirect()->action([UserController::class, 'index']); } public function agreePrivacy() @@ -213,13 +211,13 @@ public function agreePrivacy() $user->privacy_accepted = new \DateTime(); if ($user->save()) { Log::info('User: '.$user->name.' ('.$user->person->prsn_ldap_id.') accepted the privacy policy.'); - Session::put('message', trans('mainLang.privacyAccepted')); - Session::put('msgType', 'success'); + session()->put('message', trans('mainLang.privacyAccepted')); + session()->put('msgType', 'success'); return redirect('/'); } - Session::put('message', 'mainLang.fatalErrorUponSaving'); - Session::put('msgType', 'danger'); + session()->put('message', 'mainLang.fatalErrorUponSaving'); + session()->put('msgType', 'danger'); redirect(); } @@ -235,7 +233,7 @@ public function updateData(Request $request, User $user) if (!Auth::user()->can('update', $user)) { Utilities::error(trans('mainLang.accessDenied')); - return Redirect::back(); + return back(); } $data = []; if (Auth::user()->isAn(RoleUtility::PRIVILEGE_ADMINISTRATOR) || Auth::user()->hasPermissionsInSection($user->section, @@ -244,7 +242,7 @@ public function updateData(Request $request, User $user) if ($validator->fails()) { Utilities::error(trans('mainLang.changesWereReset')); - return Redirect::back()->withErrors($validator)->withInput($request->all()); + return back()->withErrors($validator)->withInput($request->all()); } $data['givenname'] = $request->input('givenname'); $data['lastname'] = $request->input('lastname'); @@ -328,6 +326,6 @@ public function updateData(Request $request, User $user) } - return Redirect::back(); + return back(); } } diff --git a/app/Http/Controllers/UserPersonalPageController.php b/app/Http/Controllers/UserPersonalPageController.php index d131352f0..61cd25c98 100644 --- a/app/Http/Controllers/UserPersonalPageController.php +++ b/app/Http/Controllers/UserPersonalPageController.php @@ -49,10 +49,10 @@ public function updatePerson() $user->is_name_private = $isNamePrivate; $user->save(); // Return to the the section management page - Session::put('message', trans('mainLang.changesSaved')); - Session::put('msgType', 'success'); + session()->put('message', trans('mainLang.changesSaved')); + session()->put('msgType', 'success'); - return \Redirect::back(); + return \back(); } public function registerGoogleAuth() @@ -63,13 +63,13 @@ public function registerGoogleAuth() $secret = $request->input("secret"); $currentCode = $request->input('currentCode'); if (!$this->validateGoogle2fa($google2fa, $currentCode, $secret)) { - return Redirect::back()->withInput($request->all())->withErrors(['code'=>'invalid code']); + return back()->withInput($request->all())->withErrors(['code'=>'invalid code']); } /** @var User $user */ $user = \Auth::user(); $user->setGoogle2faSecretAttribute($secret); $user->save(); - \Session::put('2faVeryfied', true); + session()->put('2faVeryfied', true); return Redirect::route('user.personalpage'); } @@ -79,7 +79,7 @@ public function unregisterGoogleAuth() $user = \Auth::user(); $user->google2fa_secret = ''; $user->save(); - return Redirect::back(); + return back(); } private function validateGoogle2fa(Google2FA $google2fa, $key, $secret) diff --git a/app/Http/Controllers/ViewModeController.php b/app/Http/Controllers/ViewModeController.php index aee051f31..2d6440381 100644 --- a/app/Http/Controllers/ViewModeController.php +++ b/app/Http/Controllers/ViewModeController.php @@ -32,7 +32,7 @@ public function switchMode($mode) $userSettings->view_mode = $mode; $userSettings->save(); } - \Session::put('view_mode', $mode); + session()->put('view_mode', $mode); return redirect()->back(); } diff --git a/app/Http/Controllers/WeekController.php b/app/Http/Controllers/WeekController.php index 8356569b4..182b93cb5 100644 --- a/app/Http/Controllers/WeekController.php +++ b/app/Http/Controllers/WeekController.php @@ -5,15 +5,12 @@ use Illuminate\Http\RedirectResponse; use Lara\Survey; use Request; -use Redirect; use View; use Cache; use DateTime; use DateInterval; - use Lara\Http\Requests; use Lara\Http\Controllers\Controller; - use Lara\ClubEvent; use Lara\Schedule; use Lara\Person; @@ -31,7 +28,7 @@ class WeekController extends Controller { public function currentWeek() { $currentDate = new DateTime(); - return Redirect::action('WeekController@showWeek', array('year' => $currentDate->format("Y"), + return redirect()->action([WeekController::class, 'showWeek'], array('year' => $currentDate->format("Y"), 'week' => $currentDate->format('W'))); } /** diff --git a/app/Http/Controllers/YearController.php b/app/Http/Controllers/YearController.php index e195d5f6a..56d5f31de 100644 --- a/app/Http/Controllers/YearController.php +++ b/app/Http/Controllers/YearController.php @@ -4,15 +4,13 @@ use Lara\Section; use Request; -use Redirect; use View; - use Lara\Http\Requests; use Lara\Http\Controllers\Controller; - use Lara\ClubEvent; -class YearController extends Controller { +class YearController extends Controller +{ /** * Fills missing parameters - if no year specified use current year. @@ -21,7 +19,10 @@ class YearController extends Controller { */ public function currentYear() { - return Redirect::action( 'YearController@showYear', ['year' => date("Y")] ); + return redirect()->action( + [YearController::class, 'showYear'], + ['year' => date("Y")] + ); } @@ -33,28 +34,28 @@ public function currentYear() * @return view calendarView * @return ClubEvent[] $events * @return string $date - */ + */ public function showYear($year) { - $yearStart = $year.'01'.'01'; - $yearEnd = $year.'12'.'31'; + $yearStart = $year . '01' . '01'; + $yearEnd = $year . '12' . '31'; $previous = $year - 1; $next = $year + 1; $date = date("Y", strtotime($yearStart)); - $events = ClubEvent::where('evnt_date_start','>=',$yearStart) - ->where('evnt_date_start','<=',$yearEnd) - ->with('section') - ->orderBy('evnt_date_start') - ->orderBy('evnt_time_start') - ->get(); - + $events = ClubEvent::where('evnt_date_start', '>=', $yearStart) + ->where('evnt_date_start', '<=', $yearEnd) + ->with('section') + ->orderBy('evnt_date_start') + ->orderBy('evnt_time_start') + ->get(); + $sections = Section::query()->where('id', '>', 0) - ->orderBy('title') - ->get(['id', 'title', 'color']); + ->orderBy('title') + ->get(['id', 'title', 'color']); - return View::make('listView', compact('sections','events','date', 'previous', 'next')); + return View::make('listView', compact('sections', 'events', 'date', 'previous', 'next')); } } diff --git a/app/Http/Middleware/AdminOnly.php b/app/Http/Middleware/AdminOnly.php index 433263659..87f2861c0 100644 --- a/app/Http/Middleware/AdminOnly.php +++ b/app/Http/Middleware/AdminOnly.php @@ -5,7 +5,6 @@ use Closure; use Lara\Utilities; use Lara\utilities\RoleUtility; -use Redirect; use Auth; class AdminOnly @@ -20,13 +19,13 @@ class AdminOnly public function handle($request, Closure $next) { if (!Auth::check()) { - Utilities::error(trans('auth.notAuthenticated')); - return Redirect('/'); + Utilities::error(__('auth.notAuthenticated')); + return redirect('/'); } if (!Auth::user()->isAn(RoleUtility::PRIVILEGE_ADMINISTRATOR)) { - Utilities::error(trans('auth.missingPermissions')); - return Redirect('/'); + Utilities::error(__('auth.missingPermissions')); + return redirect('/'); } return $next($request); diff --git a/app/Http/Middleware/CheckRoles.php b/app/Http/Middleware/CheckRoles.php index 8dc8665f6..211810b2c 100644 --- a/app/Http/Middleware/CheckRoles.php +++ b/app/Http/Middleware/CheckRoles.php @@ -4,7 +4,6 @@ use Closure; use Auth; -use Redirect; use Lara\Utilities; class CheckRoles @@ -20,14 +19,14 @@ public function handle($request, Closure $next, ...$params) { if (!Auth::check()) { Utilities::error(trans('auth.notAuthenticated')); - return Redirect('/'); + return redirect('/'); } $hasRole = Auth::user()->roles()->whereIn('name',$params)->exists(); if (!$hasRole) { Utilities::error(trans('auth.missingPermissions')); - return Redirect('/'); + return redirect('/'); } return $next($request); diff --git a/app/Http/Middleware/ClOnly.php b/app/Http/Middleware/ClOnly.php index 3c9026916..6f3b1b9fc 100644 --- a/app/Http/Middleware/ClOnly.php +++ b/app/Http/Middleware/ClOnly.php @@ -20,12 +20,12 @@ public function handle($request, Closure $next) { if (!Auth::check()) { Utilities::error(trans('auth.notAuthenticated')); - return Redirect('/'); + return redirect('/'); } if (!Auth::user()->isAn(RoleUtility::PRIVILEGE_CL,RoleUtility::PRIVILEGE_ADMINISTRATOR)) { Utilities::error(trans('auth.missingPermissions')); - return Redirect('/'); + return redirect('/'); } return $next($request); diff --git a/app/Http/Middleware/Creator.php b/app/Http/Middleware/Creator.php index ebd6d452d..6da052f42 100644 --- a/app/Http/Middleware/Creator.php +++ b/app/Http/Middleware/Creator.php @@ -3,10 +3,10 @@ namespace Lara\Http\Middleware; use Closure; +use Lara\Http\Controllers\MonthController; use Lara\Survey; use Lara\utilities\RoleUtility; use PhpParser\Node\Scalar\String_; -use Redirect; class Creator { @@ -33,7 +33,7 @@ public function handle($request, Closure $next, $classpath, $routeParameterName) } else { $request->session()->put('message', 'Dir fehlt die nötige Berechtigung!'); $request->session()->put('msgType', 'danger'); - return Redirect::action('MonthController@currentMonth'); + return redirect()->action([MonthController::class, 'currentMonth']); } } } diff --git a/app/Http/Middleware/DeadlineSurvey.php b/app/Http/Middleware/DeadlineSurvey.php index 1228951a2..b70548767 100644 --- a/app/Http/Middleware/DeadlineSurvey.php +++ b/app/Http/Middleware/DeadlineSurvey.php @@ -4,8 +4,8 @@ use Carbon\Carbon; use Closure; +use Lara\Http\Controllers\SurveyController; use Lara\utilities\RoleUtility; -use Redirect; use Lara\Survey; class DeadlineSurvey @@ -53,6 +53,6 @@ private function surveyRequestNotPermitted($request, $survey) 'Die Deadline ist überschritten, jetzt können nurnoch Clubleitung/Marketing/Admin die Umfrage ausfüllen'); $request->session()->put('msgType', 'danger'); - return Redirect::action('SurveyController@show', [$survey->id]); + return redirect()->action([SurveyController::class, 'show'], [$survey->id]); } } diff --git a/app/Http/Middleware/Language.php b/app/Http/Middleware/Language.php index aa9537d44..de08747e2 100755 --- a/app/Http/Middleware/Language.php +++ b/app/Http/Middleware/Language.php @@ -3,12 +3,8 @@ namespace Lara\Http\Middleware; use App; -use Application; use Closure; -use Config; -use Log; -use Redirector; -use Session; +use Illuminate\Http\Request; class Language { @@ -19,19 +15,19 @@ class Language * @param \Closure $next * @return mixed */ - public function handle($request, Closure $next) + public function handle(Request $request, Closure $next) { - if (Session::has('language') && array_key_exists(Session::get('language'), Config::get('languages'))) { - App::setLocale(Session::get('language')); + if ($request->session()->has('language') && array_key_exists(session('language'), config('languages'))) { + App::setLocale(session('language')); } else { //Detect Browser Prefered language $locale = substr($request->server('HTTP_ACCEPT_LANGUAGE', "de"), 0, 2); - if (isset($locale) && array_key_exists($locale, Config::get('languages'))) { + if (isset($locale) && array_key_exists($locale, config('languages'))) { App::setLocale($locale); - Session::put('language', $locale); + session(['language' => $locale]); } else { //Optional as Laravel will automatically set the fallback language if there is none specified - App::setLocale(Config::get('app.locale')); + App::setLocale(config('app.locale')); } } diff --git a/app/Http/Middleware/ManagingUsersOnly.php b/app/Http/Middleware/ManagingUsersOnly.php index b788b76fd..45d3eae49 100644 --- a/app/Http/Middleware/ManagingUsersOnly.php +++ b/app/Http/Middleware/ManagingUsersOnly.php @@ -6,7 +6,7 @@ use Auth; use Lara\Utilities; use Lara\utilities\RoleUtility; -use Session; + class ManagingUsersOnly { @@ -21,12 +21,12 @@ public function handle($request, Closure $next) { if (!Auth::check()) { Utilities::error(trans('auth.notAuthenticated')); - return Redirect('/'); + return redirect('/'); } if (!Auth::user()->isAn(RoleUtility::PRIVILEGE_MARKETING, RoleUtility::PRIVILEGE_ADMINISTRATOR)) { Utilities::error(trans('auth.missingPermissions')); - return Redirect('/'); + return redirect('/'); } return $next($request); diff --git a/app/Http/Middleware/PrivateEntry.php b/app/Http/Middleware/PrivateEntry.php index f0fa2ea9b..fb9fd966a 100644 --- a/app/Http/Middleware/PrivateEntry.php +++ b/app/Http/Middleware/PrivateEntry.php @@ -4,8 +4,8 @@ use Closure; use Illuminate\Support\Facades\Auth; +use Lara\Http\Controllers\MonthController; use Lara\Survey; -use Redirect; class PrivateEntry { @@ -27,7 +27,7 @@ public function handle($request, Closure $next, $classpath, $routeParameterName) } else { $request->session()->put('message', 'Dir fehlt die nötige Berechtigung!'); $request->session()->put('msgType', 'danger'); - return Redirect::action('MonthController@currentMonth'); + return redirect()->action([MonthController::class, 'currentMonth']); } } } diff --git a/app/Http/Middleware/RejectGuests.php b/app/Http/Middleware/RejectGuests.php index 7b8c5ceca..e85b6832d 100644 --- a/app/Http/Middleware/RejectGuests.php +++ b/app/Http/Middleware/RejectGuests.php @@ -3,9 +3,8 @@ namespace Lara\Http\Middleware; use Closure; -use Redirect; use Auth; -use Session; +use Lara\Utilities; class RejectGuests { @@ -20,10 +19,8 @@ public function handle($request, Closure $next) { if (Auth::check()) { return $next($request); - } else { - Session::put('message', 'Bitte einloggen'); - Session::put('msgType', 'danger'); - return Redirect('/'); } + Utilities::error(__('auth.notAuthenticated')); + return redirect('/'); } } diff --git a/app/Http/Middleware/Verify2FaToken.php b/app/Http/Middleware/Verify2FaToken.php index cb6d84b3c..420e0ce56 100644 --- a/app/Http/Middleware/Verify2FaToken.php +++ b/app/Http/Middleware/Verify2FaToken.php @@ -18,8 +18,8 @@ public function handle($request, Closure $next) if (!($request->is('2fa') or $request->is('lang*'))) { if (\Auth::check()) { - if (!empty(\Auth::user()->google2fa_secret ) and !\Session::get("2faVeryfied", false)) { - \Session::push('targeturl',$request->url()); + if (!empty(\Auth::user()->google2fa_secret ) and !session("2faVeryfied", false)) { + session()->push('targeturl', $request->url()); return \Redirect::route('lara.2fa'); } } diff --git a/app/Http/Requests/SurveyRequest.php b/app/Http/Requests/SurveyRequest.php index ddf3f1a58..d520c468a 100644 --- a/app/Http/Requests/SurveyRequest.php +++ b/app/Http/Requests/SurveyRequest.php @@ -42,7 +42,10 @@ public function rules() 'type_select.*' => 'in:1,2,3|required', ]; - $questions_type = $this->request->get('type_select'); + + + + $questions_type = request('type_select'); foreach($questions_type as $key => $question_type) { if ($question_type === 3) { $rules['answerOption.' . $key] = 'required'; @@ -56,13 +59,13 @@ public function messages() { $messages = []; - foreach($this->request->get('questionText') as $key => $val) { + foreach(request('questionText') as $key => $val) { $messages['questionText.'.$key.'.string'] = 'Die Frage #'.($key+1).'muss eine Zeichenkette sein.'; $messages['questionText.'.$key.'.min'] = 'Die Frage #'.($key+1).' muss mindestens :min Zeichen enthalten.'; $messages['questionText.'.$key.'.required'] = 'Die Frage #'.($key+1).' wurde leer gelassen. Bitte fülle sie aus oder lösche sie!'; } - foreach($this->request->get('type_select') as $key => $val) { + foreach(request('type_select') as $key => $val) { $messages['type_select.'.$key.'.in'] = 'Für die Frage #'.($key+1).' wurde ein fehlerhafter Fragetyp ausgewählt!'; $messages['type_select.'.$key.'.required'] = 'Für die Frage #'.($key+1).' wurde kein Fragetyp ausgewählt!'; } diff --git a/app/Settings.php b/app/Settings.php index 336be5ba3..98881a32a 100755 --- a/app/Settings.php +++ b/app/Settings.php @@ -24,7 +24,7 @@ public function applyToSession() return $attr != 'userId'; })->each(function ($attr) { if (isset($this[$attr]) && !is_null($this[$attr])) { - \Session::put($attr, $this[$attr]); + session([$attr, $this[$attr]]); } }); } diff --git a/app/User.php b/app/User.php index 488b35fac..d05a4d6ac 100644 --- a/app/User.php +++ b/app/User.php @@ -52,11 +52,13 @@ class User extends Authenticatable 'password', 'remember_token', 'google2fa_secret', ]; - protected $dates = [ - 'on_leave' - ]; - + /** + * The attributes that should be cast. + * + * @var array + */ protected $casts = [ + 'on_leave' => 'datetime', 'is_name_private' => 'boolean' ]; diff --git a/app/Utilities.php b/app/Utilities.php index ccf449a2e..95f0b4234 100755 --- a/app/Utilities.php +++ b/app/Utilities.php @@ -6,7 +6,7 @@ use Auth; use Illuminate\Support\Facades\Cache; use Lara\Http\Controllers\IcalController; -use Session; + class Utilities @@ -89,17 +89,15 @@ static function getEventTypeTranslation($typeNumber) static function error($message) { - if (!Session::has('message')) { - Session::put('message', $message); - Session::put('msgType', 'danger'); + if (!session()->has('message')) { + session(['message' => $message, 'msgType' => 'danger']); } } static function success($message) { - if (!Session::has('message')) { - Session::put('message', $message); - Session::put('msgType', 'success'); + if (!session()->has('message')) { + session(['message'=> $message, 'msgType' => 'success']); } } } diff --git a/app/utilities/CacheUtility.php b/app/utilities/CacheUtility.php index 04ed94e41..cd317a450 100644 --- a/app/utilities/CacheUtility.php +++ b/app/utilities/CacheUtility.php @@ -22,7 +22,7 @@ class CacheUtility */ static function remember($key, \Closure $closure) { - $viewmode = \Session::get('view_mode', 'light'); + $viewmode = session('view_mode', 'light'); $user = \Auth::hasUser(); return \Cache::rememberForever($key.'-'.$viewmode.'-'.$user, $closure); diff --git a/app/utilities/LdapUtility.php b/app/utilities/LdapUtility.php index 43918834d..ad7f66b2a 100644 --- a/app/utilities/LdapUtility.php +++ b/app/utilities/LdapUtility.php @@ -23,7 +23,7 @@ public static function connect() { // CONNECTING TO LDAP SERVER - $ldapConn = ldap_connect(\Config::get('bcLDAP.server'), \Config::get('bcLDAP.port')); + $ldapConn = ldap_connect(config('bcLDAP.server'), config('bcLDAP.port')); // Set some ldap options for talking to AD // LDAP_OPT_PROTOCOL_VERSION: LDAP protocol version @@ -33,8 +33,8 @@ public static function connect() // Bind as a domain admin $ldap_bind = ldap_bind($ldapConn, - Config::get('bcLDAP.admin-username'), - Config::get('bcLDAP.admin-password')); + config('bcLDAP.admin-username'), + config('bcLDAP.admin-password')); return $ldapConn; } @@ -49,8 +49,8 @@ public static function getEntry($ldapConn, $userId) foreach (self::OUS as $ou) { // Search for a bc-Club user with the uid number entered $search = ldap_search($ldapConn, - Config::get('bcLDAP.' . $ou) . - Config::get('bcLDAP.base-dn'), + config('bcLDAP.' . $ou) . + config('bcLDAP.base-dn'), '(uid=' . $userId . ')'); $userEntry = ldap_first_entry($ldapConn, $search); if ($userEntry !== false) { diff --git a/artisan b/artisan index df630d0d6..41e00b32a 100644 --- a/artisan +++ b/artisan @@ -1,6 +1,8 @@ #!/usr/bin/env php handle( | Shutdown The Application |-------------------------------------------------------------------------- | -| Once Artisan has finished running. We will fire off the shutdown events +| Once Artisan has finished running, we will fire off the shutdown events | so that any final work may be done by the application before we shut | down the process. This is the last thing to happen to the request. | @@ -48,4 +50,4 @@ $status = $kernel->handle( $kernel->terminate($input, $status); -exit($status); +exit($status); \ No newline at end of file diff --git a/composer.json b/composer.json index 07446e616..7d7722390 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,7 @@ "sort-packages": true, "optimize-autoloader": true }, - "description": "A calender with personnel scheduling for club management, built on top of Laravel 8.", + "description": "A calender with personnel scheduling for club management, built on top of Laravel 9.", "keywords": [ "calendar", "scheduling", @@ -40,19 +40,19 @@ "license": "GPL-3.0", "name": "ilsc-ev/lara", "require": { - "php": ">=7.3", + "php": "^8.0.2", "ext-json": "*", "bacon/bacon-qr-code": "^2.0", - "barryvdh/laravel-ide-helper": "^2.6", + "barryvdh/laravel-ide-helper": "^2.13", "eluceo/ical": "^2.0.0", "erusev/parsedown": "^1.7", "johngrogg/ics-parser": "^3", "justinrainbow/json-schema": "^5.2", - "laravel/framework": "^8", + "laravel/framework": "^9.0", "laravel/legacy-factories": "^1.3", - "laravel/tinker": "^2.0", + "laravel/tinker": "^2.7", "laravel/ui": "^3.0", "laravelcollective/html": "^6", "pragmarx/google2fa-laravel": "^2.0", @@ -60,14 +60,14 @@ "wol-soft/php-json-schema-model-generator-production": "^0.19.0" }, "require-dev": { - "nunomaduro/collision": "^5.0", + "nunomaduro/collision": "^6.1", "doctrine/dbal": "^3.0", - "facade/ignition": "^2.5", + "spatie/laravel-ignition": "^1.0", "fakerphp/faker": "^1.14", "filp/whoops": "^2.7.3", - "mockery/mockery": "~1.6.0", + "mockery/mockery": "^1.4.4", "orangehill/iseed": "dev-master", - "phpunit/phpunit": "^9" + "phpunit/phpunit": "^9.5.10" }, "scripts": { "post-create-project-cmd": [ @@ -90,6 +90,6 @@ ] }, "type": "project", - "minimum-stability": "dev", + "minimum-stability": "stable", "prefer-stable": true } diff --git a/config/app.php b/config/app.php index 39aaaa30a..72eed784c 100644 --- a/config/app.php +++ b/config/app.php @@ -1,4 +1,5 @@ 'Lara', @@ -21,7 +23,7 @@ | | This value determines the "environment" your application is currently | running in. This may determine how you prefer to configure various - | services your application utilizes. Set this in your ".env" file. + | services the application utilizes. Set this in your ".env" file. | */ @@ -38,9 +40,9 @@ | */ - 'debug' => env('APP_DEBUG', false), + 'debug' => (bool) env('APP_DEBUG', false), - /* +/* |-------------------------------------------------------------------------- | Application URL |-------------------------------------------------------------------------- @@ -53,6 +55,9 @@ 'url' => env('APP_URL', 'http://localhost'), + 'asset_url' => env('ASSET_URL'), + + /* |-------------------------------------------------------------------------- | Application Timezone @@ -92,6 +97,19 @@ 'fallback_locale' => 'en', + /* + |-------------------------------------------------------------------------- + | Faker Locale + |-------------------------------------------------------------------------- + | + | This locale will be used by the Faker PHP library when generating fake + | data for your database seeds. For example, this will be used to get + | localized telephone numbers, street address information and more. + | + */ + + 'faker_locale' => 'de_DE', + /* |-------------------------------------------------------------------------- | Encryption Key @@ -107,6 +125,24 @@ 'cipher' => 'AES-256-CBC', + /* + |-------------------------------------------------------------------------- + | Maintenance Mode Driver + |-------------------------------------------------------------------------- + | + | These configuration options determine the driver used to determine and + | manage Laravel's "maintenance mode" status. The "cache" driver will + | allow maintenance mode to be controlled across multiple machines. + | + | Supported drivers: "file", "cache" + | + */ + + 'maintenance' => [ + 'driver' => 'file', + // 'store' => 'redis', + ], + /* |-------------------------------------------------------------------------- | Logging Configuration @@ -201,51 +237,12 @@ | */ - 'aliases' => [ - - 'App' => Illuminate\Support\Facades\App::class, - 'Artisan' => Illuminate\Support\Facades\Artisan::class, - 'Auth' => Illuminate\Support\Facades\Auth::class, - 'Blade' => Illuminate\Support\Facades\Blade::class, - 'Broadcast' => Illuminate\Support\Facades\Broadcast::class, - 'Bus' => Illuminate\Support\Facades\Bus::class, - 'Cache' => Illuminate\Support\Facades\Cache::class, - 'Config' => Illuminate\Support\Facades\Config::class, - 'Cookie' => Illuminate\Support\Facades\Cookie::class, - 'Crypt' => Illuminate\Support\Facades\Crypt::class, - 'DB' => Illuminate\Support\Facades\DB::class, - 'Eloquent' => Illuminate\Database\Eloquent\Model::class, - 'Event' => Illuminate\Support\Facades\Event::class, - 'File' => Illuminate\Support\Facades\File::class, - 'Gate' => Illuminate\Support\Facades\Gate::class, - 'Hash' => Illuminate\Support\Facades\Hash::class, - 'Lang' => Illuminate\Support\Facades\Lang::class, - 'Log' => Illuminate\Support\Facades\Log::class, - 'Mail' => Illuminate\Support\Facades\Mail::class, - 'Notification' => Illuminate\Support\Facades\Notification::class, - 'Password' => Illuminate\Support\Facades\Password::class, - 'Queue' => Illuminate\Support\Facades\Queue::class, - 'Redirect' => Illuminate\Support\Facades\Redirect::class, - 'Redis' => Illuminate\Support\Facades\Redis::class, - 'Request' => Illuminate\Support\Facades\Request::class, - 'Response' => Illuminate\Support\Facades\Response::class, - 'Route' => Illuminate\Support\Facades\Route::class, - 'Schema' => Illuminate\Support\Facades\Schema::class, - 'Session' => Illuminate\Support\Facades\Session::class, - 'Storage' => Illuminate\Support\Facades\Storage::class, - 'URL' => Illuminate\Support\Facades\URL::class, - 'Validator' => Illuminate\Support\Facades\Validator::class, - 'View' => Illuminate\Support\Facades\View::class, - + 'aliases' => Facade::defaultAliases()->merge([ // Lara Aliases 'Form' => Collective\Html\FormFacade::class, 'Html' => Collective\Html\HtmlFacade::class, - 'Input' => Illuminate\Support\Facades\Input::class, + 'Input' => Input::class, 'Roles' => \Lara\utilities\RoleUtility::class, - - ], + ])->toArray(), - // development - 'faker_locale' => 'de_DE', - ]; diff --git a/config/auth.php b/config/auth.php index 0ee1c751b..784ebc0ca 100644 --- a/config/auth.php +++ b/config/auth.php @@ -31,7 +31,7 @@ | users are actually retrieved out of your database or other storage | mechanisms used by this application to persist your user's data. | - | Supported: "session", "token" + | Supported: "session" | */ @@ -40,11 +40,6 @@ 'driver' => 'session', 'provider' => 'users', ], - - 'api' => [ - 'driver' => 'token', - 'provider' => 'users', - ], ], /* @@ -85,10 +80,14 @@ | than one user table or model in the application and you want to have | separate password reset settings based on the specific user types. | - | The expire time is the number of minutes that the reset token should be + | The expire time is the number of minutes that each reset token will be | considered valid. This security feature keeps tokens short-lived so | they have less time to be guessed. You may change this as needed. | + | The throttle setting is the number of seconds a user must wait before + | generating more password reset tokens. This prevents the user from + | quickly generating a very large amount of password reset tokens. + | */ 'passwords' => [ @@ -96,7 +95,21 @@ 'provider' => 'users', 'table' => 'password_resets', 'expire' => 60, + 'throttle' => 60, ], ], -]; + /* + |-------------------------------------------------------------------------- + | Password Confirmation Timeout + |-------------------------------------------------------------------------- + | + | Here you may define the amount of seconds before a password confirmation + | times out and the user is prompted to re-enter their password via the + | confirmation screen. By default, the timeout lasts for three hours. + | + */ + + 'password_timeout' => 10800, + +]; \ No newline at end of file diff --git a/config/broadcasting.php b/config/broadcasting.php index 5eecd2b26..8f5acfd18 100644 --- a/config/broadcasting.php +++ b/config/broadcasting.php @@ -11,7 +11,7 @@ | framework when an event needs to be broadcast. You may set this to | any of the connections defined in the "connections" array below. | - | Supported: "pusher", "redis", "log", "null" + | Supported: "pusher", "ably", "redis", "log", "null" | */ @@ -36,8 +36,20 @@ 'secret' => env('PUSHER_APP_SECRET'), 'app_id' => env('PUSHER_APP_ID'), 'options' => [ - // + 'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com', + 'port' => env('PUSHER_PORT', 443), + 'scheme' => env('PUSHER_SCHEME', 'https'), + 'encrypted' => true, + 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https', ], + 'client_options' => [ + // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html + ], + ], + + 'ably' => [ + 'driver' => 'ably', + 'key' => env('ABLY_KEY'), ], 'redis' => [ @@ -55,4 +67,4 @@ ], -]; +]; \ No newline at end of file diff --git a/config/cache.php b/config/cache.php index e87f0320f..a22d92f94 100644 --- a/config/cache.php +++ b/config/cache.php @@ -1,5 +1,7 @@ env('CACHE_DRIVER', 'file'), @@ -26,6 +26,9 @@ | well as their drivers. You may even define multiple stores for the | same cache driver to group types of items stored in your caches. | + | Supported drivers: "apc", "array", "database", "file", + | "memcached", "redis", "dynamodb", "octane", "null" + | */ 'stores' => [ @@ -36,12 +39,14 @@ 'array' => [ 'driver' => 'array', + 'serialize' => false, ], 'database' => [ 'driver' => 'database', 'table' => 'cache', 'connection' => null, + 'lock_connection' => null, ], 'file' => [ @@ -57,7 +62,7 @@ env('MEMCACHED_PASSWORD'), ], 'options' => [ - // Memcached::OPT_CONNECT_TIMEOUT => 2000, + // Memcached::OPT_CONNECT_TIMEOUT => 2000, ], 'servers' => [ [ @@ -70,7 +75,21 @@ 'redis' => [ 'driver' => 'redis', - 'connection' => 'default', + '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'), + 'endpoint' => env('DYNAMODB_ENDPOINT'), + ], + + 'octane' => [ + 'driver' => 'octane', ], ], @@ -80,12 +99,12 @@ | Cache Key Prefix |-------------------------------------------------------------------------- | - | When utilizing a RAM based store such as APC or Memcached, there might - | be other applications utilizing the same cache. So, we'll specify a - | value to get prefixed to all our keys so we can avoid collisions. + | When utilizing the APC, database, memcached, Redis, or DynamoDB cache + | stores there might be other applications using the same cache. For + | that reason, you may prefix every cache key to avoid collisions. | */ - 'prefix' => 'laravel', + 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'), -]; +]; \ No newline at end of file diff --git a/config/cors.php b/config/cors.php new file mode 100644 index 000000000..6119ab64f --- /dev/null +++ b/config/cors.php @@ -0,0 +1,34 @@ + ['api/*', 'sanctum/csrf-cookie'], + + 'allowed_methods' => ['*'], + + 'allowed_origins' => ['*'], + + 'allowed_origins_patterns' => [], + + 'allowed_headers' => ['*'], + + 'exposed_headers' => [], + + 'max_age' => 0, + + 'supports_credentials' => false, + +]; \ No newline at end of file diff --git a/config/database.php b/config/database.php index 55d14c896..b659e6e31 100644 --- a/config/database.php +++ b/config/database.php @@ -1,5 +1,7 @@ [ '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', - 'host' => env('DB_HOST', 'localhost'), // default: 127.0.0.1 + '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', ''), - 'charset' => 'utf8mb4', // default: utf8mb4 , Laravel 5.3: utf8 - 'collation' => 'utf8mb4_unicode_ci', // default: utf8mb4_unicode_ci , Laravel 5.3: utf8_unicode_ci + 'unix_socket' => env('DB_SOCKET', ''), + 'charset' => 'utf8mb4', + 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', - 'strict' => false, // default: true - 'engine' => 'InnoDB ROW_FORMAT=DYNAMIC', + 'prefix_indexes' => true, + 'strict' => false, // With true (default), we have some problems with the settings table + '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'), @@ -62,10 +73,26 @@ 'password' => env('DB_PASSWORD', ''), 'charset' => 'utf8', 'prefix' => '', - 'schema' => 'public', + 'prefix_indexes' => true, + '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' => '', + 'prefix_indexes' => true, + // 'encrypt' => env('DB_ENCRYPT', 'yes'), + // 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'), + ], + ], /* @@ -87,43 +114,38 @@ |-------------------------------------------------------------------------- | | Redis is an open source, fast, and advanced key-value store that also - | provides a richer set of commands than a typical key-value systems + | provides a richer body of commands than a typical key-value system | such as APC or Memcached. Laravel makes it easy to dig right in. | */ 'redis' => [ - 'client' => 'predis', + 'client' => env('REDIS_CLIENT', 'phpredis'), + + 'options' => [ + 'cluster' => env('REDIS_CLUSTER', 'redis'), + 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), + ], 'default' => [ + 'url' => env('REDIS_URL'), 'host' => env('REDIS_HOST', '127.0.0.1'), - 'password' => env('REDIS_PASSWORD', null), - 'port' => env('REDIS_PORT', 6379), - 'database' => 0, + 'username' => env('REDIS_USERNAME'), + 'password' => env('REDIS_PASSWORD'), + 'port' => env('REDIS_PORT', '6379'), + 'database' => env('REDIS_DB', '0'), ], - ], - + 'cache' => [ + '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'), + 'database' => env('REDIS_CACHE_DB', '1'), + ], - /* - |-------------------------------------------------------------------------- - | PDO Fetch Style - |-------------------------------------------------------------------------- - | - | # This was removed in Laravel 5.4, adding back for reference. - | # If not used until next update - remove. - | # (Maxim) - | - | By default, database results will be returned as instances of the PHP - | stdClass object; however, you may desire to retrieve records in an - | array format for simplicity. Here you can tweak the fetch style. - | - */ + ], - // Laravel 5.3 style: - // 'fetch' => PDO::FETCH_OBJ, - - // Laravel 5.2 style: (this worked for Lara in Laravel 5.3) - // 'fetch' => PDO::FETCH_CLASS, -]; +]; \ No newline at end of file diff --git a/config/filesystems.php b/config/filesystems.php index f59cf9e99..1d2de1322 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -13,20 +13,7 @@ | */ - 'default' => 'local', - - /* - |-------------------------------------------------------------------------- - | Default Cloud Filesystem Disk - |-------------------------------------------------------------------------- - | - | Many applications store files both locally and in the cloud. For this - | reason, you may specify a default "cloud" driver here. This driver - | will be bound as the Cloud disk implementation in the container. - | - */ - - 'cloud' => 's3', + 'default' => env('FILESYSTEM_DISK', 'local'), /* |-------------------------------------------------------------------------- @@ -35,9 +22,9 @@ | | Here you may configure as many filesystem "disks" as you wish, and you | may even configure multiple disks of the same driver. Defaults have - | been setup for each driver as an example of the required options. + | been set up for each driver as an example of the required values. | - | Supported Drivers: "local", "ftp", "s3", "rackspace" + | Supported Drivers: "local", "ftp", "sftp", "s3" | */ @@ -46,6 +33,7 @@ 'local' => [ 'driver' => 'local', 'root' => storage_path('app'), + 'throw' => false, ], 'public' => [ @@ -53,16 +41,36 @@ 'root' => storage_path('app/public'), 'url' => env('APP_URL').'/storage', 'visibility' => 'public', + 'throw' => false, ], 's3' => [ 'driver' => 's3', - 'key' => env('AWS_KEY'), - 'secret' => env('AWS_SECRET'), - 'region' => env('AWS_REGION'), + '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, ], ], -]; + /* + |-------------------------------------------------------------------------- + | Symbolic Links + |-------------------------------------------------------------------------- + | + | Here you may configure the symbolic links that will be created when the + | `storage:link` Artisan command is executed. The array keys should be + | the locations of the links and the values should be their targets. + | + */ + + 'links' => [ + public_path('storage') => storage_path('app/public'), + ], + +]; \ No newline at end of file diff --git a/config/hashing.php b/config/hashing.php new file mode 100644 index 000000000..8e37353a9 --- /dev/null +++ b/config/hashing.php @@ -0,0 +1,52 @@ + 'bcrypt', + + /* + |-------------------------------------------------------------------------- + | Bcrypt Options + |-------------------------------------------------------------------------- + | + | Here you may specify the configuration options that should be used when + | passwords are hashed using the Bcrypt algorithm. This will allow you + | to control the amount of time it takes to hash the given password. + | + */ + + 'bcrypt' => [ + 'rounds' => env('BCRYPT_ROUNDS', 10), + ], + + /* + |-------------------------------------------------------------------------- + | Argon Options + |-------------------------------------------------------------------------- + | + | Here you may specify the configuration options that should be used when + | passwords are hashed using the Argon algorithm. These will allow you + | to control the amount of time it takes to hash the given password. + | + */ + + 'argon' => [ + 'memory' => 65536, + 'threads' => 1, + 'time' => 4, + ], + +]; \ No newline at end of file diff --git a/config/logging.php b/config/logging.php index 443823080..525319cff 100644 --- a/config/logging.php +++ b/config/logging.php @@ -1,6 +1,11 @@ env('LOG_CHANNEL', 'daily'), + + 'default' => env('LOG_CHANNEL', 'stack'), + + /* + |-------------------------------------------------------------------------- + | Deprecations Log Channel + |-------------------------------------------------------------------------- + | + | This option controls the log channel that should be used to log warnings + | regarding deprecated PHP and library features. This allows you to get + | your application ready for upcoming major versions of dependencies. + | + */ + + 'deprecations' => [ + 'channel' => env('LOG_DEPRECATIONS_CHANNEL', 'null'), + 'trace' => false, + ], + /* |-------------------------------------------------------------------------- | Log Channels @@ -26,43 +49,74 @@ | "custom", "stack" | */ + 'channels' => [ 'stack' => [ 'driver' => 'stack', 'channels' => ['single'], + 'ignore_exceptions' => false, ], + 'single' => [ 'driver' => 'single', 'path' => storage_path('logs/laravel.log'), - 'level' => 'debug', + 'level' => env('LOG_LEVEL', 'debug'), ], + 'daily' => [ 'driver' => 'daily', 'path' => storage_path('logs/laravel.log'), - 'level' => 'debug', - 'days' => 7, + 'level' => env('LOG_LEVEL', 'debug'), + 'days' => 14, ], + 'slack' => [ 'driver' => 'slack', 'url' => env('LOG_SLACK_WEBHOOK_URL'), 'username' => 'Laravel Log', 'emoji' => ':boom:', - 'level' => 'critical', + 'level' => env('LOG_LEVEL', 'critical'), ], + + 'papertrail' => [ + 'driver' => 'monolog', + 'level' => env('LOG_LEVEL', 'debug'), + 'handler' => env('LOG_PAPERTRAIL_HANDLER', SyslogUdpHandler::class), + 'handler_with' => [ + 'host' => env('PAPERTRAIL_URL'), + 'port' => env('PAPERTRAIL_PORT'), + 'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'), + ], + ], + 'stderr' => [ 'driver' => 'monolog', + 'level' => env('LOG_LEVEL', 'debug'), 'handler' => StreamHandler::class, + 'formatter' => env('LOG_STDERR_FORMATTER'), 'with' => [ 'stream' => 'php://stderr', ], ], + 'syslog' => [ 'driver' => 'syslog', - 'level' => 'debug', + 'level' => env('LOG_LEVEL', 'debug'), ], + 'errorlog' => [ 'driver' => 'errorlog', - 'level' => 'debug', + 'level' => env('LOG_LEVEL', 'debug'), + ], + + 'null' => [ + 'driver' => 'monolog', + 'handler' => NullHandler::class, + ], + + 'emergency' => [ + 'path' => storage_path('logs/laravel.log'), ], ], -]; + +]; \ No newline at end of file diff --git a/config/mail.php b/config/mail.php index bb92224c5..ac831794e 100644 --- a/config/mail.php +++ b/config/mail.php @@ -4,45 +4,81 @@ /* |-------------------------------------------------------------------------- - | Mail Driver + | Default Mailer |-------------------------------------------------------------------------- | - | Laravel supports both SMTP and PHP's "mail" function as drivers for the - | sending of e-mail. You may specify which one you're using throughout - | your application here. By default, Laravel is setup for SMTP mail. - | - | Supported: "smtp", "sendmail", "mailgun", "mandrill", "ses", - | "sparkpost", "log", "array" + | This option controls the default mailer that is used to send any email + | messages sent by your application. Alternative mailers may be setup + | and used as needed; however, this mailer will be used by default. | */ - 'driver' => env('MAIL_DRIVER', 'smtp'), + 'default' => env('MAIL_MAILER', 'smtp'), /* |-------------------------------------------------------------------------- - | SMTP Host Address + | Mailer Configurations |-------------------------------------------------------------------------- | - | Here you may provide the host address of the SMTP server used by your - | applications. A default option is provided that is compatible with - | the Mailgun mail service which will provide reliable deliveries. + | Here you may configure all of the mailers used by your application plus + | their respective settings. Several examples have been configured for + | you and you are free to add your own as your application requires. | - */ - - 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), - - /* - |-------------------------------------------------------------------------- - | SMTP Host Port - |-------------------------------------------------------------------------- + | Laravel supports a variety of mail "transport" drivers to be used while + | sending an e-mail. You will specify which one you are using for your + | mailers below. You are free to add additional mailers as required. | - | This is the SMTP port used by your application to deliver e-mails to - | users of the application. Like the host we have set this value to - | stay compatible with the Mailgun e-mail application by default. + | Supported: "smtp", "sendmail", "mailgun", "ses", + | "postmark", "log", "array", "failover" | */ - 'port' => env('MAIL_PORT', 587), + 'mailers' => [ + 'smtp' => [ + 'transport' => 'smtp', + 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), + 'port' => env('MAIL_PORT', 587), + 'encryption' => env('MAIL_ENCRYPTION', 'tls'), + 'username' => env('MAIL_USERNAME'), + 'password' => env('MAIL_PASSWORD'), + 'timeout' => null, + 'local_domain' => env('MAIL_EHLO_DOMAIN'), + ], + + 'ses' => [ + 'transport' => 'ses', + ], + + 'mailgun' => [ + 'transport' => 'mailgun', + ], + + 'postmark' => [ + 'transport' => 'postmark', + ], + + 'sendmail' => [ + 'transport' => 'sendmail', + 'path' => env('MAIL_SENDMAIL_PATH', '/usr/sbin/sendmail -bs -i'), + ], + + 'log' => [ + 'transport' => 'log', + 'channel' => env('MAIL_LOG_CHANNEL'), + ], + + 'array' => [ + 'transport' => 'array', + ], + + 'failover' => [ + 'transport' => 'failover', + 'mailers' => [ + 'smtp', + 'log', + ], + ], + ], /* |-------------------------------------------------------------------------- @@ -60,47 +96,6 @@ 'name' => env('MAIL_FROM_NAME', 'Example'), ], - /* - |-------------------------------------------------------------------------- - | E-Mail Encryption Protocol - |-------------------------------------------------------------------------- - | - | Here you may specify the encryption protocol that should be used when - | the application send e-mail messages. A sensible default using the - | transport layer security protocol should provide great security. - | - */ - - 'encryption' => env('MAIL_ENCRYPTION', 'tls'), - - /* - |-------------------------------------------------------------------------- - | SMTP Server Username - |-------------------------------------------------------------------------- - | - | If your SMTP server requires a username for authentication, you should - | set it here. This will get used to authenticate with your server on - | connection. You may also set the "password" value below this one. - | - */ - - 'username' => env('MAIL_USERNAME'), - - 'password' => env('MAIL_PASSWORD'), - - /* - |-------------------------------------------------------------------------- - | Sendmail System Path - |-------------------------------------------------------------------------- - | - | When using the "sendmail" driver to send e-mails, we will need to know - | the path to where Sendmail lives on this server. A default path has - | been provided here, which will work well on most of your systems. - | - */ - - 'sendmail' => '/usr/sbin/sendmail -bs', - /* |-------------------------------------------------------------------------- | Markdown Mail Settings @@ -120,4 +115,4 @@ ], ], -]; +]; \ No newline at end of file diff --git a/config/queue.php b/config/queue.php index 4d83ebd0c..63b57c2ba 100644 --- a/config/queue.php +++ b/config/queue.php @@ -4,18 +4,16 @@ /* |-------------------------------------------------------------------------- - | Default Queue Driver + | Default Queue Connection Name |-------------------------------------------------------------------------- | | Laravel's queue API supports an assortment of back-ends via a single | API, giving you convenient access to each back-end using the same - | syntax for each one. Here you may set the default queue driver. - | - | Supported: "sync", "database", "beanstalkd", "sqs", "redis", "null" + | syntax for every one. Here you may define a default connection. | */ - 'default' => env('QUEUE_DRIVER', 'sync'), + 'default' => env('QUEUE_CONNECTION', 'sync'), /* |-------------------------------------------------------------------------- @@ -26,6 +24,8 @@ | is used by your application. A default configuration has been added | for each back-end shipped with Laravel. You are free to add more. | + | Drivers: "sync", "database", "beanstalkd", "sqs", "redis", "null" + | */ 'connections' => [ @@ -39,6 +39,7 @@ 'table' => 'jobs', 'queue' => 'default', 'retry_after' => 90, + 'after_commit' => false, ], 'beanstalkd' => [ @@ -46,22 +47,28 @@ 'host' => 'localhost', 'queue' => 'default', 'retry_after' => 90, + 'block_for' => 0, + 'after_commit' => false, ], 'sqs' => [ 'driver' => 'sqs', - 'key' => 'your-public-key', - 'secret' => 'your-secret-key', - 'prefix' => 'https://sqs.us-east-1.amazonaws.com/your-account-id', - 'queue' => 'your-queue-name', - 'region' => 'us-east-1', + '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' => 'default', + 'queue' => env('REDIS_QUEUE', 'default'), 'retry_after' => 90, + 'block_for' => null, + 'after_commit' => false, ], ], @@ -78,8 +85,9 @@ */ 'failed' => [ + 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), 'database' => env('DB_CONNECTION', 'mysql'), 'table' => 'failed_jobs', ], -]; +]; \ No newline at end of file diff --git a/config/services.php b/config/services.php index 61db29818..fd51dbe39 100644 --- a/config/services.php +++ b/config/services.php @@ -8,31 +8,27 @@ |-------------------------------------------------------------------------- | | This file is for storing the credentials for third party services such - | as Stripe, Mailgun, SparkPost and others. This file provides a sane - | default location for this type of information, allowing packages - | to have a conventional place to find your various credentials. + | as Mailgun, Postmark, AWS and more. This file provides the de facto + | location for this type of information, allowing packages to have + | a conventional file to locate the various service credentials. | */ 'mailgun' => [ 'domain' => env('MAILGUN_DOMAIN'), 'secret' => env('MAILGUN_SECRET'), + 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), + 'scheme' => 'https', ], - 'ses' => [ - 'key' => env('SES_KEY'), - 'secret' => env('SES_SECRET'), - 'region' => 'us-east-1', - ], - - 'sparkpost' => [ - 'secret' => env('SPARKPOST_SECRET'), + 'postmark' => [ + 'token' => env('POSTMARK_TOKEN'), ], - 'stripe' => [ - 'model' => Lara\User::class, - 'key' => env('STRIPE_KEY'), - 'secret' => env('STRIPE_SECRET'), + 'ses' => [ + 'key' => env('AWS_ACCESS_KEY_ID'), + 'secret' => env('AWS_SECRET_ACCESS_KEY'), + 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), ], -]; +]; \ No newline at end of file diff --git a/config/session.php b/config/session.php index 64cf60b9c..efb6ff0da 100644 --- a/config/session.php +++ b/config/session.php @@ -1,5 +1,7 @@ 2880, // default: 120 + 'lifetime' => env('SESSION_LIFETIME', 120), 'expire_on_close' => false, @@ -70,7 +72,7 @@ | */ - 'connection' => null, + 'connection' => env('SESSION_CONNECTION'), /* |-------------------------------------------------------------------------- @@ -90,13 +92,15 @@ | Session Cache Store |-------------------------------------------------------------------------- | - | When using the "apc" or "memcached" session drivers, you may specify a - | cache store that should be used for these sessions. This value must - | correspond with one of the application's configured cache stores. + | While using one of the framework's cache driven session backends you may + | list a cache store that should be used for these sessions. This value + | must match with one of the application's configured cache "stores". + | + | Affects: "apc", "dynamodb", "memcached", "redis" | */ - 'store' => null, + 'store' => env('SESSION_STORE'), /* |-------------------------------------------------------------------------- @@ -122,7 +126,10 @@ | */ - 'cookie' => 'lara_session', + 'cookie' => env( + 'SESSION_COOKIE', + Str::slug(env('APP_NAME', 'laravel'), '_').'_session' + ), /* |-------------------------------------------------------------------------- @@ -148,7 +155,7 @@ | */ - 'domain' => env('SESSION_DOMAIN', null), + 'domain' => env('SESSION_DOMAIN'), /* |-------------------------------------------------------------------------- @@ -157,11 +164,11 @@ | | By setting this option to true, session cookies will only be sent back | to the server if the browser has a HTTPS connection. This will keep - | the cookie from being sent to you if it can not be done securely. + | the cookie from being sent to you when it can't be done securely. | */ - 'secure' => env('SESSION_SECURE_COOKIE', null), + 'secure' => env('SESSION_SECURE_COOKIE'), /* |-------------------------------------------------------------------------- @@ -174,6 +181,21 @@ | */ - 'http_only' => false, // default: true + 'http_only' => true, + + /* + |-------------------------------------------------------------------------- + | Same-Site Cookies + |-------------------------------------------------------------------------- + | + | This option determines how your cookies behave when cross-site requests + | take place, and can be used to mitigate CSRF attacks. By default, we + | will set this value to "lax" since this is a secure default value. + | + | Supported: "lax", "strict", "none", null + | + */ + + 'same_site' => 'lax', -]; +]; \ No newline at end of file diff --git a/config/view.php b/config/view.php index e193ab61d..916e61b7e 100644 --- a/config/view.php +++ b/config/view.php @@ -14,7 +14,7 @@ */ 'paths' => [ - realpath(base_path('resources/views')), + resource_path('views'), ], /* @@ -28,6 +28,9 @@ | */ - 'compiled' => realpath(storage_path('framework/views')), + 'compiled' => env( + 'VIEW_COMPILED_PATH', + realpath(storage_path('framework/views')) + ), -]; +]; \ No newline at end of file diff --git a/database/migrations/2018_04_06_181320_add_initial_bd_users.php b/database/migrations/2018_04_06_181320_add_initial_bd_users.php index 344712580..27b8791f5 100644 --- a/database/migrations/2018_04_06_181320_add_initial_bd_users.php +++ b/database/migrations/2018_04_06_181320_add_initial_bd_users.php @@ -18,7 +18,7 @@ class AddInitialBdUsers extends Migration */ public function up() { - $allBDusers = Config::get('bd_users.initial'); + $allBDusers = config('bd_users.initial'); if ($allBDusers) { // creating the persons is tricky. The 'max' query is probably cached, thus we need to manually diff --git a/resources/lang/de/ILSC.php b/lang/de/ILSC.php similarity index 100% rename from resources/lang/de/ILSC.php rename to lang/de/ILSC.php diff --git a/resources/lang/de/auth.php b/lang/de/auth.php similarity index 100% rename from resources/lang/de/auth.php rename to lang/de/auth.php diff --git "a/resources/lang/de/bc-Caf\303\251.php" "b/lang/de/bc-Caf\303\251.php" similarity index 100% rename from "resources/lang/de/bc-Caf\303\251.php" rename to "lang/de/bc-Caf\303\251.php" diff --git a/resources/lang/de/bc-Club.php b/lang/de/bc-Club.php similarity index 100% rename from resources/lang/de/bc-Club.php rename to lang/de/bc-Club.php diff --git a/resources/lang/de/bd-Club.php b/lang/de/bd-Club.php similarity index 100% rename from resources/lang/de/bd-Club.php rename to lang/de/bd-Club.php diff --git a/resources/lang/de/bh-Club.php b/lang/de/bh-Club.php similarity index 100% rename from resources/lang/de/bh-Club.php rename to lang/de/bh-Club.php diff --git a/resources/lang/de/bi-Club.php b/lang/de/bi-Club.php similarity index 100% rename from resources/lang/de/bi-Club.php rename to lang/de/bi-Club.php diff --git a/resources/lang/de/mainLang.php b/lang/de/mainLang.php old mode 100755 new mode 100644 similarity index 99% rename from resources/lang/de/mainLang.php rename to lang/de/mainLang.php index 7aa180bff..21ba575f7 --- a/resources/lang/de/mainLang.php +++ b/lang/de/mainLang.php @@ -15,7 +15,7 @@ | | You want to add a new language? Steps: | in config/language.php add it in the following form: 'de' => 'Deutsch', - | in lara/resources/lang add a new folder + file in this style + | in lara//lang add a new folder + file in this style | | */ diff --git a/resources/lang/de/messages.php b/lang/de/messages.php similarity index 100% rename from resources/lang/de/messages.php rename to lang/de/messages.php diff --git a/resources/lang/de/pagination.php b/lang/de/pagination.php similarity index 100% rename from resources/lang/de/pagination.php rename to lang/de/pagination.php diff --git a/resources/lang/de/passwords.php b/lang/de/passwords.php similarity index 100% rename from resources/lang/de/passwords.php rename to lang/de/passwords.php diff --git a/resources/lang/de/revisions.php b/lang/de/revisions.php similarity index 100% rename from resources/lang/de/revisions.php rename to lang/de/revisions.php diff --git a/resources/lang/de/surveys.php b/lang/de/surveys.php similarity index 100% rename from resources/lang/de/surveys.php rename to lang/de/surveys.php diff --git a/resources/lang/de/users.php b/lang/de/users.php similarity index 100% rename from resources/lang/de/users.php rename to lang/de/users.php diff --git a/resources/lang/de/validation.php b/lang/de/validation.php similarity index 100% rename from resources/lang/de/validation.php rename to lang/de/validation.php diff --git a/resources/lang/en/ILSC.php b/lang/en/ILSC.php similarity index 100% rename from resources/lang/en/ILSC.php rename to lang/en/ILSC.php diff --git a/resources/lang/en/auth.php b/lang/en/auth.php similarity index 100% rename from resources/lang/en/auth.php rename to lang/en/auth.php diff --git "a/resources/lang/en/bc-Caf\303\251.php" "b/lang/en/bc-Caf\303\251.php" similarity index 100% rename from "resources/lang/en/bc-Caf\303\251.php" rename to "lang/en/bc-Caf\303\251.php" diff --git a/resources/lang/en/bc-Club.php b/lang/en/bc-Club.php similarity index 100% rename from resources/lang/en/bc-Club.php rename to lang/en/bc-Club.php diff --git a/resources/lang/en/bd-Club.php b/lang/en/bd-Club.php similarity index 100% rename from resources/lang/en/bd-Club.php rename to lang/en/bd-Club.php diff --git a/resources/lang/en/bh-Club.php b/lang/en/bh-Club.php similarity index 100% rename from resources/lang/en/bh-Club.php rename to lang/en/bh-Club.php diff --git a/resources/lang/en/bi-Club.php b/lang/en/bi-Club.php similarity index 100% rename from resources/lang/en/bi-Club.php rename to lang/en/bi-Club.php diff --git a/resources/lang/en/mainLang.php b/lang/en/mainLang.php old mode 100755 new mode 100644 similarity index 99% rename from resources/lang/en/mainLang.php rename to lang/en/mainLang.php index 56d093d98..273f19d73 --- a/resources/lang/en/mainLang.php +++ b/lang/en/mainLang.php @@ -15,7 +15,7 @@ | | You want to add a new language? Steps: | in config/language.php add it in the following form: 'de' => 'Deutsch', - | in lara/resources/lang add a new folder + file in this style + | in lara//lang add a new folder + file in this style | | */ diff --git a/resources/lang/en/messages.php b/lang/en/messages.php similarity index 100% rename from resources/lang/en/messages.php rename to lang/en/messages.php diff --git a/resources/lang/en/pagination.php b/lang/en/pagination.php similarity index 100% rename from resources/lang/en/pagination.php rename to lang/en/pagination.php diff --git a/resources/lang/en/passwords.php b/lang/en/passwords.php similarity index 100% rename from resources/lang/en/passwords.php rename to lang/en/passwords.php diff --git a/resources/lang/en/revisions.php b/lang/en/revisions.php similarity index 100% rename from resources/lang/en/revisions.php rename to lang/en/revisions.php diff --git a/resources/lang/en/surveys.php b/lang/en/surveys.php similarity index 100% rename from resources/lang/en/surveys.php rename to lang/en/surveys.php diff --git a/resources/lang/en/users.php b/lang/en/users.php similarity index 100% rename from resources/lang/en/users.php rename to lang/en/users.php diff --git a/resources/lang/en/validation.php b/lang/en/validation.php similarity index 100% rename from resources/lang/en/validation.php rename to lang/en/validation.php diff --git a/resources/lang/pirate/ILSC.php b/lang/pirate/ILSC.php similarity index 100% rename from resources/lang/pirate/ILSC.php rename to lang/pirate/ILSC.php diff --git a/resources/lang/pirate/auth.php b/lang/pirate/auth.php similarity index 100% rename from resources/lang/pirate/auth.php rename to lang/pirate/auth.php diff --git "a/resources/lang/pirate/bc-Caf\303\251.php" "b/lang/pirate/bc-Caf\303\251.php" similarity index 100% rename from "resources/lang/pirate/bc-Caf\303\251.php" rename to "lang/pirate/bc-Caf\303\251.php" diff --git a/resources/lang/pirate/bc-Club.php b/lang/pirate/bc-Club.php similarity index 100% rename from resources/lang/pirate/bc-Club.php rename to lang/pirate/bc-Club.php diff --git a/resources/lang/pirate/bd-Club.php b/lang/pirate/bd-Club.php similarity index 100% rename from resources/lang/pirate/bd-Club.php rename to lang/pirate/bd-Club.php diff --git a/resources/lang/pirate/bh-Club.php b/lang/pirate/bh-Club.php similarity index 100% rename from resources/lang/pirate/bh-Club.php rename to lang/pirate/bh-Club.php diff --git a/resources/lang/pirate/bi-Club.php b/lang/pirate/bi-Club.php similarity index 100% rename from resources/lang/pirate/bi-Club.php rename to lang/pirate/bi-Club.php diff --git a/resources/lang/pirate/mainLang.php b/lang/pirate/mainLang.php old mode 100755 new mode 100644 similarity index 99% rename from resources/lang/pirate/mainLang.php rename to lang/pirate/mainLang.php index facd046d9..4f25f5433 --- a/resources/lang/pirate/mainLang.php +++ b/lang/pirate/mainLang.php @@ -15,7 +15,7 @@ | | You want to add a new language? Steps: | in config/language.php add it in the following form: 'de' => 'Deutsch', - | in lara/resources/lang add a new folder + file in this style + | in lara//lang add a new folder + file in this style | | */ diff --git a/resources/lang/pirate/messages.php b/lang/pirate/messages.php similarity index 100% rename from resources/lang/pirate/messages.php rename to lang/pirate/messages.php diff --git a/resources/lang/pirate/pagination.php b/lang/pirate/pagination.php similarity index 100% rename from resources/lang/pirate/pagination.php rename to lang/pirate/pagination.php diff --git a/resources/lang/pirate/passwords.php b/lang/pirate/passwords.php similarity index 100% rename from resources/lang/pirate/passwords.php rename to lang/pirate/passwords.php diff --git a/resources/lang/pirate/revisions.php b/lang/pirate/revisions.php similarity index 100% rename from resources/lang/pirate/revisions.php rename to lang/pirate/revisions.php diff --git a/resources/lang/pirate/surveys.php b/lang/pirate/surveys.php similarity index 100% rename from resources/lang/pirate/surveys.php rename to lang/pirate/surveys.php diff --git a/resources/lang/pirate/users.php b/lang/pirate/users.php similarity index 100% rename from resources/lang/pirate/users.php rename to lang/pirate/users.php diff --git a/resources/lang/pirate/validation.php b/lang/pirate/validation.php similarity index 100% rename from resources/lang/pirate/validation.php rename to lang/pirate/validation.php diff --git a/phpunit.xml b/phpunit.xml index 2dee40e63..cadf20ee5 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,22 +1,31 @@ - - - - ./app - - - - - ./tests/Feature - - - ./tests/Unit - - - - - - - - - + + + + ./tests/Unit + + + ./tests/Feature + + + + + ./app + + + + + + + + + + + + + + \ No newline at end of file diff --git a/resources/views/layouts/master.blade.php b/resources/views/layouts/master.blade.php index 87cb91286..37540b104 100755 --- a/resources/views/layouts/master.blade.php +++ b/resources/views/layouts/master.blade.php @@ -28,7 +28,7 @@ - diff --git a/resources/views/partials/message.blade.php b/resources/views/partials/message.blade.php index 5082c692f..9838e1097 100644 --- a/resources/views/partials/message.blade.php +++ b/resources/views/partials/message.blade.php @@ -1,14 +1,13 @@ {{-- STATUS MESSAGE: if there are any errors, show them here --}} -@if(Session::has('message')) +@if(session()->has('message')) @php - $messageType = Session::get('msgType') ? Session::get('msgType') : 'info' + $messageType = session('msgType') ? session('msgType') : 'info' @endphp
- {{ Session::get('message') }} + {{ session('message') }} @php - Session::forget('message'); - Session::forget('msgType'); + session()->forget(['message', 'msgType']); @endphp
@endif diff --git a/resources/views/partials/month/monthCell.blade.php b/resources/views/partials/month/monthCell.blade.php index 8c26fecd4..4921e23ff 100644 --- a/resources/views/partials/month/monthCell.blade.php +++ b/resources/views/partials/month/monthCell.blade.php @@ -28,7 +28,7 @@ @else - {{-- meaning Session::has'userId' OR !$survey->is_private == 0 --}} + {{-- meaning session()->has'userId' OR !$survey->is_private == 0 --}} {{-- so session has a valid user OR the guest can see this survey because it isn't private --}}
diff --git a/resources/views/partials/navigation.blade.php b/resources/views/partials/navigation.blade.php index 90892c1f5..6fd6f402d 100755 --- a/resources/views/partials/navigation.blade.php +++ b/resources/views/partials/navigation.blade.php @@ -65,7 +65,7 @@ {{ __('mainLang.language') }}