Skip to content

Commit

Permalink
Merge pull request #11 from lara-zeus/update-3
Browse files Browse the repository at this point in the history
upgrade to last versions
  • Loading branch information
atmonshi authored Jan 23, 2024
2 parents 6bc0599 + 7af3e94 commit 0fa4392
Show file tree
Hide file tree
Showing 103 changed files with 1,842 additions and 1,177 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ php artisan make:filament-user
### Layout
- create your first layout and set the slug in the 'AdminPanelProvider' file:
```php
RainPlugin::make()
DynamicDashboardPlugin::make()
->defaultLayout('new-page')
```
the default is: `home-page`.
Expand Down
46 changes: 33 additions & 13 deletions app/Filament/Resources/UserResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,33 @@

use App\Filament\Resources\UserResource\Pages;
use App\Models\User;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables\Columns\IconColumn;
use Filament\Tables\Columns\ImageColumn;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Filters\Filter;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Hash;

class UserResource extends Resource
{
protected static ?string $model = User::class;

protected static ?int $navigationSort = 9;
protected static ?int $navigationSort = 1;

protected static ?string $navigationIcon = 'heroicon-o-lock-closed';

public static function getNavigationLabel(): string
public static function getNavigationBadge(): ?string
{
return static::getModel()::count();
}

/*public static function getNavigationLabel(): string
{
return 'Users';
}
Expand All @@ -35,7 +43,7 @@ public static function getPluralLabel(): string
public static function getLabel(): string
{
return 'user';
}
}*/

public static function getNavigationGroup(): ?string
{
Expand All @@ -45,35 +53,47 @@ public static function getNavigationGroup(): ?string
public static function form(Form $form): Form
{
return $form->schema([
TextInput::make('name')->required(),
TextInput::make('email')->email()->required(),
TextInput::make('password')
->password()
->maxLength(255),
Section::make()
->hiddenLabel()
->columns()
->schema([
TextInput::make('name')->required(),
TextInput::make('email')->email()->required(),
TextInput::make('password')
->dehydrateStateUsing(fn ($state) => Hash::make($state))
->password()
->revealable()
->revealable()
->maxLength(255),
]),
]);
}

public static function table(Table $table): Table
{
return $table
->columns([
TextColumn::make('id')
->sortable(),
ImageColumn::make('avatar_url')
->toggleable()
->circular(),
TextColumn::make('name')
->sortable()
->searchable(),
TextColumn::make('email')
->sortable()
->toggleable()
->description(fn (User $record) => $record->email)
->searchable(),
IconColumn::make('email_verified_at')
->boolean()
->default(0)
->sortable()
->searchable(),
TextColumn::make('created_at')
->dateTime('M j, Y')
->toggleable(isToggledHiddenByDefault: true)
->toggleable()
->sortable(),
TextColumn::make('updated_at')
->dateTime('M j, Y')
->toggleable(isToggledHiddenByDefault: true)
->sortable(),
])
->filters([
Expand Down
14 changes: 3 additions & 11 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,14 @@
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
use LaraZeus\Boredom\Concerns\HasBoringAvatar;
use Spatie\Permission\Traits\HasRoles;

class User extends Authenticatable implements FilamentUser, MustVerifyEmail
{
use CanResetPassword, HasApiTokens, HasFactory, HasRoles, Notifiable;
use CanResetPassword, HasApiTokens, HasBoringAvatar, HasFactory, HasRoles, Notifiable;

/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'name',
'email',
'password',
];
protected $guarded = [];

/**
* The attributes that should be hidden for serialization.
Expand Down
2 changes: 1 addition & 1 deletion app/Policies/NavigationPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use App\Models\User;
use Illuminate\Auth\Access\HandlesAuthorization;
use RyanChandler\FilamentNavigation\Models\Navigation;
use LaraZeus\Sky\Models\Navigation;

class NavigationPolicy
{
Expand Down
4 changes: 2 additions & 2 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Filament\Facades\Filament;
use Filament\Forms\Components\Select;
use Illuminate\Support\ServiceProvider;
use RyanChandler\FilamentNavigation\FilamentNavigation;
use LaraZeus\Sky\SkyPlugin;

class AppServiceProvider extends ServiceProvider
{
Expand All @@ -23,7 +23,7 @@ public function register(): void
public function boot(): void
{
Filament::serving(function () {
FilamentNavigation::get()
SkyPlugin::get()
->itemType(
__('App link'),
[
Expand Down
65 changes: 49 additions & 16 deletions app/Providers/Filament/AdminPanelProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Providers\Filament;

use BezhanSalleh\FilamentShield\FilamentShieldPlugin;
use Filament\Http\Middleware\Authenticate;
use Filament\Http\Middleware\DisableBladeIconComponents;
use Filament\Http\Middleware\DispatchServingFilamentEvent;
Expand All @@ -19,10 +20,11 @@
use Illuminate\Session\Middleware\StartSession;
use Illuminate\View\Middleware\ShareErrorsFromSession;
use LaraZeus\Bolt\BoltPlugin;
use LaraZeus\Rain\RainPlugin;
use LaraZeus\Boredom\BoringAvatarPlugin;
use LaraZeus\DynamicDashboard\DynamicDashboardPlugin;
use LaraZeus\Sky\SkyPlugin;
use LaraZeus\Wind\WindPlugin;
use RyanChandler\FilamentNavigation\FilamentNavigation;
use Swis\Filament\Backgrounds\FilamentBackgroundsPlugin;

class AdminPanelProvider extends PanelProvider
{
Expand All @@ -32,35 +34,38 @@ public function panel(Panel $panel): Panel
->default()
->id('admin')
->path('admin')
->homeUrl('/')
->login()
->profile()
->colors([
'primary' => Color::Emerald,
])
->defaultAvatarProvider(
\LaraZeus\Boredom\BoringAvatarsProvider::class
)
->viteTheme('resources/css/filament/admin/theme.css')
->plugins([
WindPlugin::make()
->windPrefix('contact-us'),
SkyPlugin::make(),
BoltPlugin::make(),
RainPlugin::make()
->defaultLayout('new-page')
->rainPrefix('/home'),

FilamentNavigation::make(),
SpatieLaravelTranslatablePlugin::make()
->defaultLocales([config('app.locale')]),
\BezhanSalleh\FilamentShield\FilamentShieldPlugin::make(),
// Nav
->navigationGroups([
'Site',
'CMS',
'Forms',
'Users',
])
// all plugins
->plugins($this->plugins())
// discoverable
->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
//
->pages([
Pages\Dashboard::class,
])
->discoverWidgets(in: app_path('Filament/Widgets'), for: 'App\\Filament\\Widgets')
->widgets([
Widgets\AccountWidget::class,
Widgets\FilamentInfoWidget::class,
])
//
->middleware([
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
Expand All @@ -76,4 +81,32 @@ public function panel(Panel $panel): Panel
Authenticate::class,
]);
}

public function plugins(): array
{
return [
WindPlugin::make()
->windPrefix('contact-us')
->navigationGroupLabel('CMS'),

BoringAvatarPlugin::make()
->colors(['0A0310', '49007E', 'FF005B', 'FF7D10', 'FFB238']),

SkyPlugin::make()
->navigationGroupLabel('CMS'),

BoltPlugin::make()
->navigationGroupLabel('Forms'),

DynamicDashboardPlugin::make()
->navigationGroupLabel('Site')
->defaultLayout('new-page'),

SpatieLaravelTranslatablePlugin::make()
->defaultLocales([config('app.locale')]),

FilamentShieldPlugin::make(),
FilamentBackgroundsPlugin::make(),
];
}
}
12 changes: 7 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@
"bezhansalleh/filament-shield": "^3.0",
"guzzlehttp/guzzle": "^7.2",
"lara-zeus/artemis": "^1.0",
"lara-zeus/bolt": "^2.1",
"lara-zeus/rain": "^2.1",
"lara-zeus/sky": "^3.2",
"lara-zeus/wind": "^3.1",
"lara-zeus/bolt": "^3.13",
"lara-zeus/boredom": "^1.0",
"lara-zeus/dynamic-dashboard": "^3.0",
"lara-zeus/sky": "^3.4",
"lara-zeus/wind": "^3.2",
"laravel/framework": "^10.10",
"laravel/sanctum": "^3.2"
"laravel/sanctum": "^3.2",
"swisnl/filament-backgrounds": "^1.1"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
Expand Down
Loading

0 comments on commit 0fa4392

Please sign in to comment.