This commit is contained in:
2023-12-14 19:03:25 +05:00
parent a3771218f0
commit 445884782a
12 changed files with 404 additions and 30 deletions

View File

@@ -5,10 +5,17 @@ namespace App\Repos\System\Nova;
use App\Models\System\Location\Province;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Gate;
use Laravel\Nova\Events\ServingNova;
class NovaRepo
{
/**
* Initial path
* @var string
*/
protected static string $initialPath = '/dashboards/main';
/**
* Serving nova application
*/
@@ -17,6 +24,24 @@ class NovaRepo
static::setLocale($event);
}
/**
* Initial path for nova
*/
public static function initialPath(): string
{
return request()->user() && request()->user()->withoutRole()
? request()->user()->profilePage()
: static::$initialPath;
}
/**
* This gate determines who can access Nova in non-local environments.
*/
public static function viewNova(): Closure
{
return fn ($user) => $user->isSystemUser() || $user->phoneIsVerified();
}
/**
* Set locales
*/
@@ -43,6 +68,22 @@ class NovaRepo
};
}
/**
* Nova Footer
*/
public static function footer(): Closure
{
return fn () => view('vendor.nova.partials.footer')->render();
}
/**
* Check if user is me
*/
public static function isMe(): Closure
{
return fn () => Gate::allows('isMe', auth()->user());
}
/**
* Depends on region
*/