I am trying to upload multiple images on database but its not storing. when I var_dump the data I see the images but it's not storing in database.
the code for store the data is---
$ad = AdList::create([
"userId" => $userId,
"adTitle" => $request->data['title'],
"photos" => json_encode($imageList),
]);
var_dump($ad);
And the I got after var_dump is---
["photos"]=>
string(51) "["dodo (1)_1668406861.webp","dodo_1668406862.webp"]"
what is the reason for not storing in database? I am using laravel & vue
Ad_list model---
class AdList extends Model
{
use HasFactory, Sluggable;
protected $guarded = [];
// public $incrementing = false;
// protected $table = 'ad_lists';
// protected $keyType = 'string';
public function user(){
return $this->belongsTo(User::class, 'userId','id');
}
public function category(){
return $this->belongsTo(Category::class, 'catId','id');
}
public function subcategory(){
return $this->belongsTo(Category::class, 'subCatId','id');
}
public function businessPage(){
return $this->belongsTo(BusinessPage::class, 'userId','userId');
}
/**
* Return the sluggable configuration array for this model.
*
* @return array
*/
public function sluggable(): array
{
return [
'url' => [
'source' => 'title'
]
];
}
}