1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 05:32:39 +01:00
invoiceninja/app/Http/Requests/User/AttachCompanyUserRequest.php
David Bomba a7048ee61d
Implement Support for PHP 7.4 (#3102)
* Fixes for company factor

* Add dates to create test data

* Fixes for transformers, use faker to generate random dates

* Bump to PHP 7.4git add app/Http/Requests/User/DetachCompanyUserRequest.php

* Fixes for route model binding
2019-11-28 21:35:13 +11:00

45 lines
1.2 KiB
PHP

<?php
/**
* Invoice Ninja (https://invoiceninja.com)
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2019. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Http\Requests\User;
use App\Http\Requests\Request;
use App\Models\User;
use App\Utils\Traits\MakesHash;
class AttachCompanyUserRequest extends Request
{
use MakesHash;
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize() : bool
{
return auth()->user()->isAdmin();
}
protected function prepareForValidation()
{
$this->replace([
'is_admin' => isset($request->input('is_admin')) ? $request->input('is_admin') : false,
'permissions' => isset($request->input('permissions')) ? $request->input('permissions') : '',
'settings' => isset($request->input('settings')) ? $request->input('settings') : json_encode(DefaultSettings::userSettings()),
'is_locked' => isset($request->input('is_locked')) ? $request->input('is_locked') : false,
'is_owner' => false,
]);
}
}