<?php
namespace App\Filament\Pages;
use App\Models\Photo;
use Filament\Forms\Components\FileUpload;
use Filament\Pages\Page;
use Filament\Schemas\Concerns\InteractsWithSchemas;
use Filament\Schemas\Contracts\HasSchemas;
use Filament\Schemas\Schema;
use Livewire\Attributes\Url;
class VetPhoto extends Page implements HasSchemas
{
use InteractsWithSchemas;
#[Url]
public ?int $photoId = null;
protected string $view = 'filament.pages.vet-photo';
public Photo $photo;
public ?array $data = [];
public function mount(): void
{
$this->data['file'] = 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTfHlcmASZgNOAA0mtIwob78oSLwGP1PybjDQ&s';
}
public function form(Schema $schema): Schema
{
return $schema
->components([
FileUpload::make('file')->image(),
])
->statePath('data');
}
}
<?php
namespace App\Filament\Pages;
use App\Models\Photo;
use Filament\Forms\Components\FileUpload;
use Filament\Pages\Page;
use Filament\Schemas\Concerns\InteractsWithSchemas;
use Filament\Schemas\Contracts\HasSchemas;
use Filament\Schemas\Schema;
use Livewire\Attributes\Url;
class VetPhoto extends Page implements HasSchemas
{
use InteractsWithSchemas;
#[Url]
public ?int $photoId = null;
protected string $view = 'filament.pages.vet-photo';
public Photo $photo;
public ?array $data = [];
public function mount(): void
{
$this->data['file'] = 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTfHlcmASZgNOAA0mtIwob78oSLwGP1PybjDQ&s';
}
public function form(Schema $schema): Schema
{
return $schema
->components([
FileUpload::make('file')->image(),
])
->statePath('data');
}
}