Can't save relationship on create

I have a pivot table category_comic for this relationship.

But can be saved on the edit operation.

Here are my files.

on resource
Forms\Components\Select::make('categories')
  ->relationship('categories', 'name')
  ->searchable()
  ->preload()
  ->multiple()
  ->required(),


on Comic model (guarded)
public function categories(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
{
   return $this->belongsToMany(Category::class);
}


on Category model (guarded)
 public function comic(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
{
   return $this->belongsToMany(Comic::class);
}
Screenshot_08-19-2024_12.02.39.png
Solution
Nevermind, I overridden the mount method on my Create page. So dumb. 😄
Was this page helpful?