mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-19 04:23:59 +00:00
big commit
This commit is contained in:
@@ -18,7 +18,6 @@ class CompanyResource extends JsonResource
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
dd($this->employees);
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'account_no' => $this->reference_no,
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Models;
|
||||
|
||||
use App\Classes\General\Interfaces\Documentable;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
@@ -60,11 +61,11 @@ class Company extends AbstractModel implements Documentable
|
||||
}
|
||||
|
||||
/**
|
||||
* @return hasManyThrough
|
||||
* @return belongsToMany
|
||||
*/
|
||||
public function employees(): hasManyThrough
|
||||
public function employees(): belongsToMany
|
||||
{
|
||||
return $this->hasManyThrough(User::class, CompanyEmployee::class);
|
||||
return $this->belongsToMany(User::class, (new CompanyEmployee())->getTable(), 'company_id','user_id');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user