update: return number of order when login.

This commit is contained in:
weichien00
2021-07-30 14:26:11 +08:00
parent 7fe6009669
commit 0dc68cea5a
2 changed files with 14 additions and 1 deletions
+11
View File
@@ -6,6 +6,8 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\MorphMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
@@ -56,6 +58,15 @@ class CompanyModule extends AbstractModel
return $this->belongsToMany(User::class, (new CompanyEmployee())->getTable(), 'company_module_id', 'user_id');
}
/**
* @return HasMany
*/
public function orders(): HasMany
{
return $this->HasMany(Order::class, 'company_module_id');
}
// /**
// * @return HasMany
// */