[WIP] Order process

This commit is contained in:
Ludovic CANDELLIER
2022-07-03 22:38:08 +02:00
parent bcb3e15f33
commit 06cfb92757
60 changed files with 1146 additions and 295 deletions

View File

@@ -4,7 +4,6 @@ namespace App\Models\Core\Auth;
use Carbon\Carbon;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\SoftDeletes;
use Yadahan\AuthenticationLog\AuthenticationLogable;
// use HighIdeas\UsersOnline\Traits\UsersOnlineTrait;
use Sebastienheyd\Boilerplate\Models\User as parentUser;
@@ -12,22 +11,23 @@ use Sebastienheyd\Boilerplate\Models\User as parentUser;
class User extends parentUser
{
// use UserHasTeams, UsersOnlineTrait;
use AuthenticationLogable, SoftDeletes;
use AuthenticationLogable;
protected $fillable = ['active', 'last_name', 'first_name', 'username', 'email', 'password', 'remember_token', 'last_login'];
protected $hidden = ['password', 'remember_token'];
protected $casts = [
'email_verified_at' => 'datetime',
'settings' => 'array',
];
public function passwordSecurity()
{
return $this->hasOne('App\Models\Core\Auth\PasswordSecurity');
return $this->hasOne(PasswordSecurity::class);
}
public function teams()
{
return $this->hasManyThrough(Team::class, TeamUser::class, 'user_id', 'id', 'id', 'team_id');
return $this->belongsToMany(Team::class, TeamUser::class);
}
public function scopeByTeam($query, $id)

View File

@@ -4,18 +4,22 @@ 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;
use Illuminate\Notifications\Notifiable;
use Yadahan\AuthenticationLog\AuthenticationLogable;
use App\Notifications\NewUser;
use App\Notifications\ResetPassword;
use App\Notifications\VerifyEmail;
class Customer extends Authenticatable
{
use AuthenticationLogable, SoftDeletes;
use AuthenticationLogable, Notifiable, 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',];
protected $casts = ['email_verified_at' => 'datetime'];
public function addresses()
{
@@ -34,7 +38,7 @@ class Customer extends Authenticatable
public function deliveries()
{
return $this->belongsToMany(Delivery::class, 'shop_customer_deliveries');
return $this->belongsToMany(Delivery::class, CustomerDelivery::class);
}
public function deliveries2()
@@ -47,8 +51,16 @@ class Customer extends Authenticatable
return $this->hasMany(Order::class);
}
public function User()
public function sendEmailVerificationNotification()
{
return $this->belongsTo('App\User');
if (config('boilerplate.auth.verify_email')) {
$this->notify(new VerifyEmail());
}
}
public function sendPasswordResetNotification($token)
{
$this->notify(new ResetPassword($token));
}
}