ghostrockz3d
ghostrockz3d
FFilament
Created by ghostrockz3d on 11/7/2023 in #❓┊help
Custom model for spatie media library upload and spatie settings
I want to upload a media (favicon) on laravel settings but it seems they don't work with each other so I thought I create another model called MediaSetting this is the migration notice it's the same schema as spatie laravel settings
$table->string('group');
$table->string('name')->index();
$table->string('group');
$table->string('name')->index();
And here's my SeoSettings
class ManageSeo extends SettingsPage
{
protected static string $settings = SeoSettings::class;
....
class ManageSeo extends SettingsPage
{
protected static string $settings = SeoSettings::class;
....
and so on here's the important part
Forms\Components\SpatieMediaLibraryFileUpload::make('favicon')
->collection('favicon')
->model(MediaSetting::class)
Forms\Components\SpatieMediaLibraryFileUpload::make('favicon')
->collection('favicon')
->model(MediaSetting::class)
Isn't it possible to pass the model (MediaSetting) and it uses this one for file uploads ? I would appreciate any help
2 replies
FFilament
Created by ghostrockz3d on 8/29/2023 in #❓┊help
Updated to V3 Aside flashes on route change
Basically the title I just updated to v3 but on navigation (changing the route) the aside flashes I'm assuming it's loading the js and other stuff Should I npm run build anything ?
6 replies
FFilament
Created by ghostrockz3d on 7/15/2023 in #❓┊help
Spatie media library not Saving on S3
Hello I'm using spatie media library to save images on s3 disk Right now I'm using minio for testing in development This is my form Code:
Forms\Components\SpatieMediaLibraryFileUpload::make('image')
->disk(config('filesystems.default'))
->visibility('public')
Forms\Components\SpatieMediaLibraryFileUpload::make('image')
->disk(config('filesystems.default'))
->visibility('public')
This is my model:
class Brand extends Model implements HasMedia
{
use HasFactory , InteractsWithMedia;
}
class Brand extends Model implements HasMedia
{
use HasFactory , InteractsWithMedia;
}
Here's my aws .env file:
AWS_ACCESS_KEY_ID=sail
AWS_SECRET_ACCESS_KEY=password
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=local
AWS_ENDPOINT=http://localhost:9000
AWS_URL=http://localhost:9000/local
AWS_USE_PATH_STYLE_ENDPOINT=true
AWS_ACCESS_KEY_ID=sail
AWS_SECRET_ACCESS_KEY=password
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=local
AWS_ENDPOINT=http://localhost:9000
AWS_URL=http://localhost:9000/local
AWS_USE_PATH_STYLE_ENDPOINT=true
I can see in my network tab that file gets uploaded correctly to localhost:9000(minio) and I can see it's in tmp folder But laravel media library is not saving the uploaded data in the db so it feels like user hasn't uploaded anything When I use public file system driver it works like a charm but when I use S3 it's not working correctly I would appreciate if anyone could help me
3 replies
FFilament
Created by ghostrockz3d on 6/28/2023 in #❓┊help
File Upload
I'm trying to configure file upload to work with imagekit I Created a new Adapter for FileSystem that uses ImageKit behind the scene At First I tried to use the default settings
Forms\Components\FileUpload::make('image')
->image()
->directory('narrators')
->enableDownload()
->enableOpen()
Forms\Components\FileUpload::make('image')
->image()
->directory('narrators')
->enableDownload()
->enableOpen()
But the problem is the image is stuck in /livewire-tmp and it doesn't move it to the narrators folder Then I tried this :
Forms\Components\FileUpload::make('image')
->image()
->directory('narrators')
->enableDownload()
->enableOpen()
->saveUploadedFileUsing(function ($component, TemporaryUploadedFile $file, $record) {
$filename = $component->getUploadedFileNameForStorage($file);
$result = Storage::fileExists("/livewire-tmp/${filename}");
})
Forms\Components\FileUpload::make('image')
->image()
->directory('narrators')
->enableDownload()
->enableOpen()
->saveUploadedFileUsing(function ($component, TemporaryUploadedFile $file, $record) {
$filename = $component->getUploadedFileNameForStorage($file);
$result = Storage::fileExists("/livewire-tmp/${filename}");
})
But the problem is I cannot move the file from /livewire-tmp to my folder and I ran Storage::fileExists and it seems file doesn't exists even If I use $file->exists() it returns false But I can see the fine exists in image kit I don't know how to fix this I would appreciate it if anyone could help
21 replies