tool resource

tool resource

  • tool resource

    tool resource

    tool resource...

 php artisan make:filament-resource Tool
 <?php

namespace App\Filament\Resources;

use App\Filament\Resources\ToolResource\Pages;
use App\Filament\Resources\ToolResource\RelationManagers;
use App\Models\Tool;
use Filament\Forms;
use Filament\Resources\Form;
use Filament\Resources\Resource;
use Filament\Resources\Table;
use Filament\Tables;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;

class ToolResource extends Resource
{
    protected static ?string $model = Tool::class;

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

    public static function form(Form $form): Form
    {
        return $form
            ->schema([
                Forms\Components\TextInput::make('nom')
                    ->required()
                    ->maxLength(255),
				Forms\Components\FileUpload::make('img'),                
                Forms\Components\MarkdownEditor::make('descripcio')
                    ->columnSpan('full'),
                Forms\Components\MarkdownEditor::make('body')
                    ->columnSpan('full'),
                Forms\Components\Select::make('categoria')
                    ->options([
        'requisits' => 'requisits',
        'formacio' => 'formacio',
        'framework' => 'framework',
        'css' => 'css',
		'themes' => 'themes',
        'llibreries' => 'llibreries',
        'icons' => 'icons',        
    ]),
                
                Forms\Components\TextInput::make('youtube')
                    ->maxLength(255),                
                Forms\Components\TextInput::make('web')
                    ->maxLength(255),
            ]);
    }

    public static function table(Table $table): Table
    {
        return $table
            ->columns([
                Tables\Columns\TextColumn::make('nom')->limit(10)
				->searchable()
                ->sortable(),
				Tables\Columns\ImageColumn::make('img')->width(35),                
                Tables\Columns\TextColumn::make('descripcio')->limit(15)
				->searchable()
                ->sortable(), 
                Tables\Columns\TextColumn::make('categoria')->limit(10)
				->searchable()
                ->sortable(),
                Tables\Columns\TextColumn::make('youtube')->limit(5),                
                Tables\Columns\TextColumn::make('web')->limit(5)
				->searchable()
                ->sortable(),
                Tables\Columns\TextColumn::make('updated_at')
                    ->dateTime(),
            ])
            ->filters([
                //
            ])
            ->actions([
                Tables\Actions\EditAction::make(),
            ])
            ->bulkActions([
                Tables\Actions\DeleteBulkAction::make(),
            ]);
    }
    
    public static function getRelations(): array
    {
        return [
            //
        ];
    }
    
    public static function getPages(): array
    {
        return [
            'index' => Pages\ListTools::route('/'),
            'create' => Pages\CreateTool::route('/create'),
            'edit' => Pages\EditTool::route('/{record}/edit'),
        ];
    }    
}

6 posts relacionats

  • Author
    Joan Puig

    posts Array Pdo

    Una manera adequada de nomenar aquesta consulta PDO podria ser "ObtenirPàginesPerCategoriaIEtiqueta... READ MORE
  • Author
    Joan Puig

    Quina és la diferència entre PDO i MySQLi?

    El que no està tan definit és quina és la millor manera de connectar-se a MySQL fent servir PHP. ... READ MORE
  • Author
    Joan Puig

    tailwind 5 filtres i paginacio a postslar11

    tailwind 5 filtres i paginacio a postslar11... READ MORE
  • Author
    Joan Puig

    optimitzar imatges en php

    optimitzar imatges en php... READ MORE
  • Author
    Joan Puig

    migrations

    la migracio crea i administra les taules a la base de dades de laravel... READ MORE
  • Author
    Joan Puig

    paginació en Laravel

    📌 Resum de la paginació en Laravel Laravel proporciona diferents maneres d’implementar la pagi... READ MORE