Initial Commit
This commit is contained in:
41
app/Providers/AppServiceProvider.php
Normal file
41
app/Providers/AppServiceProvider.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?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");
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user