2020-10-14 17:07:59 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Abstracts;
|
|
|
|
|
|
|
|
use App\Models\Auth\User;
|
|
|
|
use App\Traits\Jobs;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory as BaseFactory;
|
|
|
|
|
|
|
|
abstract class Factory extends BaseFactory
|
|
|
|
{
|
|
|
|
use Jobs;
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
{
|
2020-10-15 00:27:40 +03:00
|
|
|
parent::__construct();
|
|
|
|
|
2020-10-14 17:07:59 +03:00
|
|
|
$this->user = User::first();
|
|
|
|
$this->company = $this->user->companies()->first();
|
|
|
|
|
|
|
|
session(['company_id' => $this->company->id]);
|
|
|
|
setting()->setExtraColumns(['company_id' => $this->company->id]);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getCompanyUsers()
|
|
|
|
{
|
|
|
|
return $this->company->users()->enabled()->get()->pluck('id')->toArray();
|
|
|
|
}
|
|
|
|
}
|