Elasticquent
Elasticquent copied to clipboard
Query Scopes : Not working Query Scopes in model after add ElasticquentTrait
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.