finished the upgrade to filament 4. completely revamped the frontend with codex, now it looks great!
This commit is contained in:
@@ -2,23 +2,25 @@
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use BackedEnum;
|
||||
use Filament\Forms\Components\FileUpload;
|
||||
use Filament\Forms\Concerns\InteractsWithForms;
|
||||
use Filament\Forms\Contracts\HasForms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Pages\Page;
|
||||
use Filament\Schemas\Schema;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use UnitEnum;
|
||||
|
||||
class InstallPluginPage extends Page implements HasForms
|
||||
{
|
||||
use InteractsWithForms;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-cloud-arrow-up';
|
||||
protected static string|BackedEnum|null $navigationIcon = 'heroicon-o-cloud-arrow-up';
|
||||
|
||||
protected static string $view = 'filament.pages.install-plugin-page';
|
||||
protected string $view = 'filament.pages.install-plugin-page';
|
||||
|
||||
protected static ?string $navigationGroup = 'Plugins';
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Plugins';
|
||||
|
||||
protected static ?string $title = 'Install Plugin';
|
||||
|
||||
@@ -29,9 +31,9 @@ class InstallPluginPage extends Page implements HasForms
|
||||
$this->form->fill();
|
||||
}
|
||||
|
||||
public function form(Form $form): Form
|
||||
public function form(Schema $schema): Schema
|
||||
{
|
||||
return $form
|
||||
return $schema
|
||||
->schema([
|
||||
FileUpload::make('plugin_file')
|
||||
->label('Plugin File (.php)')
|
||||
@@ -59,10 +61,10 @@ class InstallPluginPage extends Page implements HasForms
|
||||
|
||||
$uploadedFile = $data['plugin_file'];
|
||||
$filename = File::basename($uploadedFile);
|
||||
$destinationPath = app_path('Api/Plugins/' . $filename);
|
||||
$destinationPath = app_path('Api/Plugins/'.$filename);
|
||||
|
||||
try {
|
||||
File::move(storage_path('app/temp_plugins/' . $filename), $destinationPath);
|
||||
File::move(storage_path('app/temp_plugins/'.$filename), $destinationPath);
|
||||
|
||||
Notification::make()
|
||||
->title('Plugin installed successfully')
|
||||
|
||||
Reference in New Issue
Block a user