[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,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));
}
}