mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 05:02:36 +01:00
handle logo upload for company
This commit is contained in:
parent
70d2531ab4
commit
db40a4ab71
@ -22,6 +22,7 @@ use App\Http\Requests\SignupRequest;
|
|||||||
use App\Jobs\Company\CreateCompany;
|
use App\Jobs\Company\CreateCompany;
|
||||||
use App\Jobs\Company\CreateCompanyToken;
|
use App\Jobs\Company\CreateCompanyToken;
|
||||||
use App\Jobs\RegisterNewAccount;
|
use App\Jobs\RegisterNewAccount;
|
||||||
|
use App\Jobs\Util\UploadAvatar;
|
||||||
use App\Models\Account;
|
use App\Models\Account;
|
||||||
use App\Models\Company;
|
use App\Models\Company;
|
||||||
use App\Models\CompanyUser;
|
use App\Models\CompanyUser;
|
||||||
@ -103,6 +104,17 @@ class CompanyController extends BaseController
|
|||||||
|
|
||||||
$company = CreateCompany::dispatchNow($request->all(), auth()->user()->company()->account);
|
$company = CreateCompany::dispatchNow($request->all(), auth()->user()->company()->account);
|
||||||
|
|
||||||
|
if($request->file('logo'))
|
||||||
|
{
|
||||||
|
$path = UploadAvatar::dispatchNow($request->file('logo'), $company->company_key);
|
||||||
|
|
||||||
|
if($path){
|
||||||
|
$company->logo = $path;
|
||||||
|
$company->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
auth()->user()->companies()->attach($company->id, [
|
auth()->user()->companies()->attach($company->id, [
|
||||||
'account_id' => $company->account->id,
|
'account_id' => $company->account->id,
|
||||||
'is_owner' => 1,
|
'is_owner' => 1,
|
||||||
@ -171,6 +183,17 @@ class CompanyController extends BaseController
|
|||||||
{
|
{
|
||||||
$company = $this->company_repo->save($request->all(), $company);
|
$company = $this->company_repo->save($request->all(), $company);
|
||||||
|
|
||||||
|
if($request->file('logo'))
|
||||||
|
{
|
||||||
|
$path = UploadAvatar::dispatchNow($request->file('logo'), $company->company_key);
|
||||||
|
|
||||||
|
if($path){
|
||||||
|
$company->logo = $path;
|
||||||
|
$company->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return $this->itemResponse($company);
|
return $this->itemResponse($company);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user