Created
September 30, 2023 14:24
-
-
Save emmexx/b7f988592bb215acce2cb1fd31a19f1a to your computer and use it in GitHub Desktop.
Filament repeater with file upload
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace App\Filament\Resources; | |
use App\Filament\Albergabici\Resources\PhotoResource\Pages; | |
use App\Filament\Albergabici\Resources\PhotoResource\RelationManagers; | |
use App\Models\Photo; | |
use DragonCode\Contracts\Cashier\Resources\Model; | |
use Filament\Forms; | |
use Filament\Forms\Components\Placeholder; | |
use Filament\Forms\Components\Repeater; | |
use Filament\Forms\Form; | |
use Filament\Resources\Resource; | |
use Filament\Tables; | |
use Filament\Tables\Table; | |
use Illuminate\Database\Eloquent\Builder; | |
use Illuminate\Database\Eloquent\SoftDeletingScope; | |
use Illuminate\Support\HtmlString; | |
class PhotoResource extends Resource | |
{ | |
protected static ?string $model = Photo::class; | |
public static function form(Form $form): Form | |
{ | |
return $form | |
->schema([ | |
Repeater::make('image') | |
->addActionLabel('Add image') | |
->maxItems(10) | |
->schema([ | |
Forms\Components\FileUpload::make('path') | |
->image() | |
->reorderable() | |
->appendFiles() | |
->maxSize(2048) | |
->directory('myFolder'), | |
]), | |
]); | |
} | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment