Edit File: User.php
<?php namespace App\Models; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\HasMany; class User extends AuthBaseModel { const IMAGEPATH = 'users'; protected $fillable = [ 'name', 'country_code', 'phone', 'email', 'password', 'image', 'city_id', 'active', 'is_blocked', 'is_approved', 'lang', 'is_notify', 'code', 'code_expire', 'lat', 'lng', 'map_desc', 'avg_rate', 'wallet_balance', 'neighborhood_to_delivered_id', 'is_busy', ]; protected $casts = [ 'lat' => 'decimal:8', 'lng' => 'decimal:8', 'is_blocked' => 'boolean', 'is_approved' => 'boolean', 'active' => 'boolean', 'is_busy' => 'boolean', ]; public function orders(): HasMany { return $this->hasMany(Order::class, 'user_id', 'id'); } public function cartItems(): HasMany { return $this->hasMany(CartItem::class, 'user_id', 'id'); } public function city(): BelongsTo { return $this->belongsTo(City::class); } public function deliveredNeighborhood(): BelongsTo { return $this->belongsTo(Neighborhood::class, 'neighborhood_to_delivered_id'); } public function searchHistory(): HasMany { return $this->hasMany(SearchHistory::class); } }
Back to File Manager