mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-09-21 17:01:33 +02:00
849f6e5439
* Fixes for Feature and browser tests * Change .env.example variable names, implement hash encoding of db numbers for URIs
57 lines
1.1 KiB
PHP
57 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Jobs\Company;
|
|
|
|
use App\Events\Company\CompanyCreated;
|
|
use App\Events\UserSignedUp;
|
|
use App\Jobs\Account\CreateAccount;
|
|
use App\Utils\Traits\MakesHash;
|
|
use Illuminate\Foundation\Bus\Dispatchable;
|
|
use Illuminate\Http\Request;
|
|
use App\Models\Account;
|
|
use App\Models\Company;
|
|
use App\Models\User;
|
|
use App\Models\UserCompany;
|
|
use Illuminate\Support\Facades\Hash;
|
|
|
|
class CreateCompany
|
|
{
|
|
use MakesHash;
|
|
use Dispatchable;
|
|
|
|
protected $request;
|
|
|
|
protected $account;
|
|
|
|
/**
|
|
* Create a new job instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
|
|
public function __construct(Request $request, $account = false)
|
|
{
|
|
$this->request = $request;
|
|
$this->account = $account;
|
|
}
|
|
|
|
/**
|
|
* Execute the job.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function handle()
|
|
{
|
|
|
|
$company = new Company();
|
|
$company->name = $this->request->first_name . ' ' . $this->request->last_name;
|
|
$company->account_id = $this->account->id;
|
|
$company->company_key = $this->createHash();
|
|
$company->ip = $this->request->ip();
|
|
$company->save();
|
|
|
|
|
|
return $company;
|
|
}
|
|
}
|