Class SpatieMediaLibraryFileUpload & SpatieMediaLibraryImageColumn not found
I have installed spatie/laravel-medialibrary already and did all the instructions below this documentation: https://filamentphp.com/plugins/filament-spatie-media-library
My ProductModel
My ProductResource
My composer.json
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia;
class Product extends Model implements HasMedia
{
use HasFactory, InteractsWithMedia;
protected $fillable = [
'product_name',
'product_description',
'category_id',
'sub_category_id',
'image',
'stock',
'bought_in',
'price',
'stock_threshold',
'status',
];
public function category(){
return $this->belongsTo(Category::class);
}
public function sub_category(){
return $this->belongsTo(SubCategory::class);
}
}
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia;
class Product extends Model implements HasMedia
{
use HasFactory, InteractsWithMedia;
protected $fillable = [
'product_name',
'product_description',
'category_id',
'sub_category_id',
'image',
'stock',
'bought_in',
'price',
'stock_threshold',
'status',
];
public function category(){
return $this->belongsTo(Category::class);
}
public function sub_category(){
return $this->belongsTo(SubCategory::class);
}
}
use Filament\Forms\Components\SpatieMediaLibraryFileUpload;
SpatieMediaLibraryFileUpload::make('image')
->directory('product-images')
->visibility('public')
->image()
->imageEditor(),
use Filament\Forms\Components\SpatieMediaLibraryFileUpload;
SpatieMediaLibraryFileUpload::make('image')
->directory('product-images')
->visibility('public')
->image()
->imageEditor(),
"require": {
"php": "^8.2",
"filament/filament": "^3.2",
"laravel/framework": "^11.9",
"laravel/tinker": "^2.9",
"livewire/livewire": "^3.5",
"shanerbaner82/panel-roles": "^0.0.3",
"spatie/laravel-medialibrary": "*",
"spatie/laravel-permission": "^6.9"
},
"require": {
"php": "^8.2",
"filament/filament": "^3.2",
"laravel/framework": "^11.9",
"laravel/tinker": "^2.9",
"livewire/livewire": "^3.5",
"shanerbaner82/panel-roles": "^0.0.3",
"spatie/laravel-medialibrary": "*",
"spatie/laravel-permission": "^6.9"
},
Filament
Spatie Media Library by Filament - Filament
Filament support for Spatie's Laravel Media Library package.
![No description](https://cdn.answeroverflow.com/1261561307321077842/image.png)
4 Replies
in your composer you don't have plugin installed
this loads an error
Problem 1
- filament/filament is locked to version v3.2.93 and an update of this package was not requested.
- anourvalar/eloquent-serialize 1.2.23 requires laravel/framework ^8.0|^9.0|^10.0|^11.0 -> satisfiable by laravel/framework[v11.9.0, ..., v11.15.0].
- Only one of these can be installed: illuminate/support[v10.33.0, ..., v10.48.16, v11.0.0, ..., v11.15.0], laravel/framework[v11.9.0, ..., v11.15.0]. laravel/framework replaces illuminate/support and thus cannot coexist with it.
- filament/actions v3.2.93 requires anourvalar/eloquent-serialize ^1.2 -> satisfiable by anourvalar/eloquent-serialize[1.2.23].
- filament/spatie-laravel-media-library-plugin v3.2.0 requires illuminate/support ^10.0 -> satisfiable by illuminate/support[v10.0.0, ..., v10.48.16].
- filament/filament v3.2.93 requires filament/actions v3.2.93 -> satisfiable by filament/actions[v3.2.93].
- Root composer.json requires filament/spatie-laravel-media-library-plugin 3.2 -> satisfiable by filament/spatie-laravel-media-library-plugin[v3.2.0].
Problem 1
- filament/filament is locked to version v3.2.93 and an update of this package was not requested.
- anourvalar/eloquent-serialize 1.2.23 requires laravel/framework ^8.0|^9.0|^10.0|^11.0 -> satisfiable by laravel/framework[v11.9.0, ..., v11.15.0].
- Only one of these can be installed: illuminate/support[v10.33.0, ..., v10.48.16, v11.0.0, ..., v11.15.0], laravel/framework[v11.9.0, ..., v11.15.0]. laravel/framework replaces illuminate/support and thus cannot coexist with it.
- filament/actions v3.2.93 requires anourvalar/eloquent-serialize ^1.2 -> satisfiable by anourvalar/eloquent-serialize[1.2.23].
- filament/spatie-laravel-media-library-plugin v3.2.0 requires illuminate/support ^10.0 -> satisfiable by illuminate/support[v10.0.0, ..., v10.48.16].
- filament/filament v3.2.93 requires filament/actions v3.2.93 -> satisfiable by filament/actions[v3.2.93].
- Root composer.json requires filament/spatie-laravel-media-library-plugin 3.2 -> satisfiable by filament/spatie-laravel-media-library-plugin[v3.2.0].
i guess you have some package version conflicts
yeah this line
filament/spatie-laravel-media-library-plugin v3.2.0 requires illuminate/support ^10.0 -> satisfiable by illuminate/support[v10.0.0, ..., v10.48.16].
tries laravel 10
you have 11
defining version as * is wrongit worked thanks