42 lines
1.0 KiB
PHP
42 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
use Illuminate\Auth\Middleware\RedirectIfAuthenticated;
|
|
use Illuminate\Auth\Middleware\Authenticate;
|
|
use Illuminate\Support\Facades\Session;
|
|
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register any application services.
|
|
*/
|
|
public function register(): void
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Bootstrap any application services.
|
|
*/
|
|
public function boot(): void
|
|
{
|
|
Schema::defaultStringLength(191);
|
|
|
|
// Authenticated Benutzer ins Dashboard umleiten
|
|
RedirectIfAuthenticated::redirectUsing(function() {
|
|
return route("admin.dashboard");
|
|
});
|
|
|
|
// Nicht Authenticated Benutzer ins Admin Login umleiten
|
|
Authenticate::redirectUsing(function() {
|
|
Session::flash("fail", "Sie müssen im Administratorbereich angemeldet sein. Bitte melden Sie sich an, um fortzufahren.");
|
|
return route("admin.login");
|
|
});
|
|
}
|
|
}
|