Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 2 years ago.
0

Here is a copy of a scope that I have:

In my model:


	public function scopeIsFeatured($query)
	{
		return $query->where('is_featured', '=', 1);
	}

In my controller:

			$pages = Content::InPrint()->IsFeatured()->orderBy('order')->get();

You should be able to chain your scope like you did but I have a feeling that the issue might be in your controller call.

Also, you might want to consider breaking up your big scope into smaller ones and just chain them like I did in my controller call.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.