Homparty dev
This commit is contained in:
parent
9252094a04
commit
ac0d5b781e
60 changed files with 3443 additions and 293 deletions
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Services\HomepartyUserCart;
|
||||
use App\User;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
|
@ -102,10 +103,15 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @method static \Illuminate\Database\Query\Builder|\App\Models\HomepartyUser withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\Models\HomepartyUser withoutTrashed()
|
||||
* @mixin \Eloquent
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\HomepartyUserOrderItem[] $homeparty_user_order_items
|
||||
* @property-read int|null $homeparty_user_order_items_count
|
||||
*/
|
||||
class HomepartyUser extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $userCart = null;
|
||||
|
||||
protected $table = 'homeparty_users';
|
||||
|
||||
protected $casts = [
|
||||
|
|
@ -117,16 +123,12 @@ class HomepartyUser extends Model
|
|||
'shipping_country_id' => 'int',
|
||||
'has_buyed' => 'bool',
|
||||
'subscribed' => 'bool',
|
||||
'token_active' => 'bool'
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'user_deleted_at'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'token'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'homeparty_id',
|
||||
|
|
@ -157,8 +159,6 @@ class HomepartyUser extends Model
|
|||
'shipping_email',
|
||||
'has_buyed',
|
||||
'subscribed',
|
||||
'token',
|
||||
'token_active',
|
||||
'notice',
|
||||
'mode',
|
||||
'user_deleted_at'
|
||||
|
|
@ -184,9 +184,15 @@ class HomepartyUser extends Model
|
|||
return $this->belongsTo('App\Models\Country','shipping_country_id');
|
||||
}
|
||||
|
||||
public function getTokenLink(){
|
||||
return url('homeparty/'.$this->token);
|
||||
public function homeparty_user_order_items(){
|
||||
return $this->hasMany('App\Models\HomepartyUserOrderItem','homeparty_user_id');
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function isAddress(){
|
||||
if($this->billing_firstname !== null){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue