I want to show my records on my category page. But I'm faced with a problem. I'm sorry for my bad English.
error: Property [movies] does not exist on this collection instance.
KategoriController.php (controller):
public function index()
{
$kategori =Kategori::All();
$filmler = $kategori->filmler;
return view('kategori', compact( 'kategori', 'filmler'));
}
Film.php (Model):
public function kategoriler()
{
return $this->belongsToMany('App\Models\Kategori', 'kategori_film');
}
Kategori.php (Model):
public function filmler()
{
return $this->belongsToMany('App\Models\Film', 'kategori_film');
}
can you please help?