Compare commits
4 Commits
b1630ea623
...
c0bfe974ad
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c0bfe974ad | ||
|
|
895c5f6226 | ||
|
|
88d84ac457 | ||
|
|
94ad59ce24 |
@@ -5,15 +5,23 @@ namespace App\Filament\Clusters\Cards\Cards\Pages;
|
|||||||
use App\Filament\Clusters\Cards\Cards\CardResource;
|
use App\Filament\Clusters\Cards\Cards\CardResource;
|
||||||
use Filament\Actions\CreateAction;
|
use Filament\Actions\CreateAction;
|
||||||
use Filament\Resources\Pages\ManageRecords;
|
use Filament\Resources\Pages\ManageRecords;
|
||||||
|
use Illuminate\Contracts\Support\Htmlable;
|
||||||
|
|
||||||
class ManageCards extends ManageRecords
|
class ManageCards extends ManageRecords
|
||||||
{
|
{
|
||||||
protected static string $resource = CardResource::class;
|
protected static string $resource = CardResource::class;
|
||||||
|
|
||||||
|
public function getTitle(): string | Htmlable
|
||||||
|
{
|
||||||
|
return __('My cards');
|
||||||
|
}
|
||||||
|
|
||||||
protected function getHeaderActions(): array
|
protected function getHeaderActions(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
CreateAction::make(),
|
CreateAction::make()
|
||||||
|
->label(__('Add card'))
|
||||||
|
->createAnother(false),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
28
app/Http/Middleware/EnsureUserHasRole.php
Normal file
28
app/Http/Middleware/EnsureUserHasRole.php
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Middleware;
|
||||||
|
|
||||||
|
use Closure;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
|
|
||||||
|
class EnsureUserHasRole
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Handle an incoming request.
|
||||||
|
*
|
||||||
|
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
||||||
|
*/
|
||||||
|
public function handle(Request $request, Closure $next): Response
|
||||||
|
{
|
||||||
|
// if user does not have any role, add role "client"
|
||||||
|
/** @var \App\Models\User */
|
||||||
|
$user = $request->user();
|
||||||
|
|
||||||
|
if ($user->roles->count() == 0) {
|
||||||
|
$user->assignRole('client');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ use App\Modules\UserAdjustments\Traits\UserAdjustments;
|
|||||||
use Filament\Models\Contracts\FilamentUser;
|
use Filament\Models\Contracts\FilamentUser;
|
||||||
use Filament\Panel;
|
use Filament\Panel;
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Filament\Models\Contracts\HasAvatar;
|
||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
use Illuminate\Support\Facades\Date;
|
use Illuminate\Support\Facades\Date;
|
||||||
@@ -20,7 +21,7 @@ use Illuminate\Support\Facades\Date;
|
|||||||
* @property Date|null $created_at
|
* @property Date|null $created_at
|
||||||
* @property Date|null $updated_at
|
* @property Date|null $updated_at
|
||||||
*/
|
*/
|
||||||
class User extends Authenticatable implements FilamentUser
|
class User extends Authenticatable implements FilamentUser, HasAvatar
|
||||||
{
|
{
|
||||||
/** @use HasFactory<\Database\Factories\UserFactory> */
|
/** @use HasFactory<\Database\Factories\UserFactory> */
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
@@ -56,4 +57,12 @@ class User extends Authenticatable implements FilamentUser
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the avatar URL for the user.
|
||||||
|
*/
|
||||||
|
public function getFilamentAvatarUrl(): ?string
|
||||||
|
{
|
||||||
|
return '/assets/images/avatar.png';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Providers\Filament;
|
namespace App\Providers\Filament;
|
||||||
|
|
||||||
use App\Http\Middleware\EnsureProfileIsFilled;
|
use App\Http\Middleware\EnsureProfileIsFilled;
|
||||||
|
use App\Http\Middleware\EnsureUserHasRole;
|
||||||
use App\Livewire\UserProfileFields;
|
use App\Livewire\UserProfileFields;
|
||||||
use App\Modules\BaseAuth\Middleware\RedirectIfUserPhoneIsUnVerfied;
|
use App\Modules\BaseAuth\Middleware\RedirectIfUserPhoneIsUnVerfied;
|
||||||
use BezhanSalleh\FilamentShield\FilamentShieldPlugin;
|
use BezhanSalleh\FilamentShield\FilamentShieldPlugin;
|
||||||
@@ -73,11 +74,12 @@ class WorkPanelProvider extends PanelProvider
|
|||||||
UserProfileFields::class,
|
UserProfileFields::class,
|
||||||
]),
|
]),
|
||||||
|
|
||||||
// FilamentUpload::make(),
|
FilamentUpload::make(),
|
||||||
])
|
])
|
||||||
->authMiddleware([
|
->authMiddleware([
|
||||||
Authenticate::class,
|
Authenticate::class,
|
||||||
EnsureProfileIsFilled::class,
|
EnsureProfileIsFilled::class,
|
||||||
|
EnsureUserHasRole::class,
|
||||||
])
|
])
|
||||||
->spa()
|
->spa()
|
||||||
->databaseTransactions()
|
->databaseTransactions()
|
||||||
|
|||||||
@@ -35,6 +35,26 @@ class ShieldSeeder extends Seeder
|
|||||||
'name' => 'admin',
|
'name' => 'admin',
|
||||||
'guard_name' => 'web',
|
'guard_name' => 'web',
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'name' => 'operator',
|
||||||
|
'guard_name' => 'web',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'operator_card',
|
||||||
|
'guard_name' => 'web',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'operator_loan',
|
||||||
|
'guard_name' => 'web',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'client',
|
||||||
|
'guard_name' => 'web',
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'currency_maintainer',
|
||||||
|
'guard_name' => 'web',
|
||||||
|
],
|
||||||
])->map(fn ($role) => [
|
])->map(fn ($role) => [
|
||||||
...$role,
|
...$role,
|
||||||
'created_at' => now(),
|
'created_at' => now(),
|
||||||
|
|||||||
@@ -730,5 +730,6 @@
|
|||||||
"Total": "Jemi",
|
"Total": "Jemi",
|
||||||
"Data": "Maglumatlar",
|
"Data": "Maglumatlar",
|
||||||
"Watch Full": "Giňişleýin",
|
"Watch Full": "Giňişleýin",
|
||||||
"Order ID": "Sargyt belgisi"
|
"Order ID": "Sargyt belgisi",
|
||||||
|
"Add card": "Kart goşmak"
|
||||||
}
|
}
|
||||||
|
|||||||
8
lang/vendor/filament-actions/tk/create.php
vendored
8
lang/vendor/filament-actions/tk/create.php
vendored
@@ -8,16 +8,16 @@ return [
|
|||||||
|
|
||||||
'modal' => [
|
'modal' => [
|
||||||
|
|
||||||
'heading' => ':label döret',
|
'heading' => ':label goşmak',
|
||||||
|
|
||||||
'actions' => [
|
'actions' => [
|
||||||
|
|
||||||
'create' => [
|
'create' => [
|
||||||
'label' => 'Döret',
|
'label' => 'Goşmak',
|
||||||
],
|
],
|
||||||
|
|
||||||
'create_another' => [
|
'create_another' => [
|
||||||
'label' => 'Döret we başgasyny döret',
|
'label' => 'Goşmak we başgasyny goşmak',
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
@@ -27,7 +27,7 @@ return [
|
|||||||
'notifications' => [
|
'notifications' => [
|
||||||
|
|
||||||
'created' => [
|
'created' => [
|
||||||
'title' => 'Döredildi',
|
'title' => 'Goşuldy',
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|||||||
8
lang/vendor/filament-forms/tk/components.php
vendored
8
lang/vendor/filament-forms/tk/components.php
vendored
@@ -625,20 +625,20 @@ return [
|
|||||||
|
|
||||||
'create_option' => [
|
'create_option' => [
|
||||||
|
|
||||||
'label' => 'Döret',
|
'label' => 'Goş',
|
||||||
|
|
||||||
'modal' => [
|
'modal' => [
|
||||||
|
|
||||||
'heading' => 'Döret',
|
'heading' => 'Goş',
|
||||||
|
|
||||||
'actions' => [
|
'actions' => [
|
||||||
|
|
||||||
'create' => [
|
'create' => [
|
||||||
'label' => 'Döret',
|
'label' => 'Goş',
|
||||||
],
|
],
|
||||||
|
|
||||||
'create_another' => [
|
'create_another' => [
|
||||||
'label' => 'Döret we başgasyny döret',
|
'label' => 'Goş we başgasyny goş',
|
||||||
],
|
],
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|||||||
BIN
public/assets/images/avatar.png
Normal file
BIN
public/assets/images/avatar.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Reference in New Issue
Block a user