Filters collapsed, customer auth and register, fix on basket recalculation

This commit is contained in:
Ludovic CANDELLIER
2022-04-20 00:16:16 +02:00
parent a12dd0c653
commit 94234218d6
31 changed files with 218 additions and 251 deletions

View File

@@ -6,29 +6,16 @@ use Carbon\Carbon;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\SoftDeletes;
use Yadahan\AuthenticationLog\AuthenticationLogable;
use HighIdeas\UsersOnline\Traits\UsersOnlineTrait;
// use HighIdeas\UsersOnline\Traits\UsersOnlineTrait;
use Sebastienheyd\Boilerplate\Models\User as parentUser;
class User extends parentUser
{
// use UserHasTeams;
use AuthenticationLogable, SoftDeletes, UsersOnlineTrait;
// use UserHasTeams, UsersOnlineTrait;
use AuthenticationLogable, SoftDeletes;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['active', 'last_name', 'first_name', 'username', 'email', 'password', 'remember_token', 'last_login'];
protected $hidden = ['password', 'remember_token'];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];

View File

@@ -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) {

View File

@@ -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()
{