Elasticquent icon indicating copy to clipboard operation
Elasticquent copied to clipboard

Query Scopes : Not working Query Scopes in model after add ElasticquentTrait

Open tobidsn opened this issue 6 years ago • 0 comments

Not working Query Scopes in model after add ElasticquentTrait

My Model

namespace App; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes;
use Elasticquent\ElasticquentTrait; class Posts extends Model { use SoftDeletes, ElasticquentTrait; protected $table = 'posts'; protected $fillable = ['id', 'title', 'slug', 'type']; public function scopeByType($query, $type) { if($type == 'all'){ return $query; } elseif ($type == 'ask') { return $query->where('type','ask'); } else { return $query->where('type', $type); } } }

Error

BadMethodCallException in Macroable.php line 74: Method ByType does not exist.

tobidsn avatar Jul 30 '18 05:07 tobidsn