This commit is contained in:
nurmuhammet committed 2023-12-14 19:03:25 +05:00
1 parent a3771218f0
commit 445884782a
12 files changed
+404 -30

No files matched your search

+41
View File
@@ -5,10 +5,17 @@
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 @@ public static function serving(ServingNova $event): void
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 @@ public static function localeSwitcherSave(): Closure
};
}
/**
* 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
*/