big commit

This commit is contained in:
omair saleh
2021-04-06 16:42:17 +08:00
parent 88124a56d2
commit 3d7f8da114
2 changed files with 3 additions and 10 deletions
+3 -2
View File
@@ -18,11 +18,12 @@ class CompanyResource extends JsonResource
*/
public function toArray($request)
{
$companyModule = $this->modules->first();
return [
'id' => $this->id,
'account_no' => $this->reference_no,
'marking' => CompanyConnections::where('module_one', $this->modules->first()->id)->first()->marking,
'email' => $this->employees->first()->email,
'marking' => CompanyConnections::where('module_one', $companyModule->id)->first()->marking,
'email' => $companyModule->employees->first()->email,
'name' => $this->name,
'type' => $this->type,
'status' => (int) $this->status,
-8
View File
@@ -3,7 +3,6 @@
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,13 +59,6 @@ class Company extends AbstractModel implements Documentable
return $this->hasMany(CompanyModule::class);
}
/**
* @return belongsToMany
*/
public function employees(): belongsToMany
{
return $this->belongsToMany(User::class, (new CompanyEmployee())->getTable(), 'company_id','user_id');
}
/**
* @return HasManyThrough