Filters collapsed, customer auth and register, fix on basket recalculation
This commit is contained in:
@@ -94,6 +94,21 @@ class Article extends Model implements HasMedia
|
||||
return $query->where($this->table . '.article_nature_id', $id);
|
||||
}
|
||||
|
||||
public function scopeByCategories($query, $categories_id)
|
||||
{
|
||||
return $categories_id ? $query->whereHas('categories', function ($query) use ($categories_id) {
|
||||
$query->whereIn('id', $categories_id);
|
||||
}) : $query;
|
||||
}
|
||||
|
||||
public function scopeByCategoryParent($query, $category_id)
|
||||
{
|
||||
$category = Category::find($category_id);
|
||||
return $category_id ? $query->whereHas('categories', function ($query) use ($category) {
|
||||
$query->where('_lft', '>=', $category->_lft)->where('_rgt', '<=', $category->_rgt);
|
||||
}) : $query;
|
||||
}
|
||||
|
||||
public function scopeByCategory($query, $category_id)
|
||||
{
|
||||
return $category_id ? $query->whereHas('categories', function ($query) use ($category_id) {
|
||||
|
||||
@@ -3,11 +3,19 @@
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Yadahan\AuthenticationLog\AuthenticationLogable;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
|
||||
class Customer extends Model
|
||||
class Customer extends Authenticatable
|
||||
{
|
||||
use AuthenticationLogable, SoftDeletes;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_customers';
|
||||
protected $fillable = ['active', 'last_name', 'first_name', 'username', 'email', 'password', 'remember_token', 'settings', 'last_login'];
|
||||
protected $hidden = ['password', 'remember_token'];
|
||||
protected $casts = ['email_verified_at' => 'datetime',];
|
||||
|
||||
public function addresses()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user