Hi am trying to save create a product from an admin panel it working fine, And now I want to add an image to a product but I keep getting this error "Array to string conversion", am using Orchid panel as administration site. Thanks for your help.
Here is my method.
public function createOrUpdate(Product $product, Request $request)
{
$product->fill($request->get('product'))->save();
$category = $request->get('category');
$product->categories()->attach($category);
Alert::success('Your product was successfully created!');
return redirect()->route('platform.product.list');
}
Here is my Model
class Product extends Model
{
use AsSource;
protected $fillable = [
'name',
'slug',
'details',
'description',
'image',
'price'
];
public function categories() {
return $this->belongsToMany('App\Category');
}
}
I have this in my ProductScreen.
Upload::make('product.image')
->title('Choose a picture for your product')
->groups('photo'),
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire