Skip to content
This repository has been archived by the owner on May 9, 2024. It is now read-only.

Commit

Permalink
Upgrade filament/filament to v3 (#774)
Browse files Browse the repository at this point in the history
  • Loading branch information
gomzyakov authored Sep 24, 2023
1 parent 3b3e2f2 commit 72f2a75
Show file tree
Hide file tree
Showing 32 changed files with 1,197 additions and 604 deletions.
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ ARG uid
RUN apt-get update && apt-get install -y \
git \
curl \
libicu-dev \
libpng-dev \
libonig-dev \
libxml2-dev \
Expand All @@ -17,8 +18,11 @@ RUN apt-get update && apt-get install -y \
# Clear cache
RUN apt-get clean && rm -rf /var/lib/apt/lists/*

# Сonfigure PHP extensions
RUN docker-php-ext-configure intl

# Install PHP extensions
RUN docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd
RUN docker-php-ext-install pdo_mysql mbstring exif intl pcntl bcmath gd

# Get latest Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
Expand Down
6 changes: 3 additions & 3 deletions app/Filament/Resources/NoteResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
use App\Filament\Resources\NoteResource\Pages;
use App\Models\Note;
use Filament\Forms;
use Filament\Resources\Form;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Resources\Table;
use Filament\Tables;
use Filament\Tables\Table;

class NoteResource extends Resource
{
protected static ?string $model = Note::class;

protected static ?string $navigationIcon = 'heroicon-o-collection';
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';

public static function form(Form $form): Form
{
Expand Down
2 changes: 1 addition & 1 deletion app/Filament/Resources/NoteResource/Pages/EditNote.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class EditNote extends EditRecord
*
* @return array<mixed>
*/
protected function getActions(): array
protected function getHeaderActions(): array
{
return [
Actions\DeleteAction::make(),
Expand Down
2 changes: 1 addition & 1 deletion app/Filament/Resources/NoteResource/Pages/ListNotes.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ListNotes extends ListRecords
*
* @return array<mixed>
*/
protected function getActions(): array
protected function getHeaderActions(): array
{
return [
Actions\CreateAction::make(),
Expand Down
58 changes: 58 additions & 0 deletions app/Providers/Filament/AdminPanelProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

namespace App\Providers\Filament;

use Filament\Http\Middleware\Authenticate;
use Filament\Http\Middleware\DisableBladeIconComponents;
use Filament\Http\Middleware\DispatchServingFilamentEvent;
use Filament\Pages;
use Filament\Panel;
use Filament\PanelProvider;
use Filament\Support\Colors\Color;
use Filament\Widgets;
use Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse;
use Illuminate\Cookie\Middleware\EncryptCookies;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
use Illuminate\Routing\Middleware\SubstituteBindings;
use Illuminate\Session\Middleware\AuthenticateSession;
use Illuminate\Session\Middleware\StartSession;
use Illuminate\View\Middleware\ShareErrorsFromSession;

class AdminPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
->default()
->id('admin')
->path('admin')
->login()
->colors([
'primary' => Color::Amber,
])
->discoverResources(in: app_path('Filament/Resources'), for: 'App\\Filament\\Resources')
->discoverPages(in: app_path('Filament/Pages'), for: 'App\\Filament\\Pages')
->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,
StartSession::class,
AuthenticateSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
DisableBladeIconComponents::class,
DispatchServingFilamentEvent::class,
])
->authMiddleware([
Authenticate::class,
]);
}
}
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"php": "^8.2",
"ext-bcmath": "*",
"doctrine/dbal": "^3.6",
"filament/filament": "^2.17",
"filament/filament": "^3.0",
"guzzlehttp/guzzle": "^7.8",
"hashids/hashids": "^5.0",
"laravel/framework": "^10.13",
Expand All @@ -26,7 +26,7 @@
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^10.2",
"qossmic/deptrac-shim": "^1.0.2",
"rector/rector": "^0.18.3",
"rector/rector": "^0.17",
"spatie/laravel-ignition": "^2.0"
},
"autoload": {
Expand Down Expand Up @@ -58,7 +58,8 @@
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
"@php artisan package:discover --ansi",
"@php artisan filament:upgrade"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force",
Expand Down
Loading

0 comments on commit 72f2a75

Please sign in to comment.