1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Minor fixes for Designs

This commit is contained in:
David Bomba 2023-11-10 09:30:12 +11:00
parent dcfb3c940e
commit 939fdbc155
2 changed files with 17 additions and 3 deletions

View File

@ -19,6 +19,13 @@ class StoreDesignRequest extends Request
private array $valid_entities = [ private array $valid_entities = [
'invoice', 'invoice',
'payment',
'client',
'quote',
'credit',
'purchase_order',
'project',
'task'
]; ];
/** /**
@ -32,7 +39,7 @@ class StoreDesignRequest extends Request
$user = auth()->user(); $user = auth()->user();
return $user->isAdmin() && $user->account->hasFeature(Account::FEATURE_API); return $user->isAdmin() && $user->account->hasFeature(Account::FEATURE_API);
;
} }
public function rules() public function rules()
@ -42,7 +49,6 @@ class StoreDesignRequest extends Request
$user = auth()->user(); $user = auth()->user();
return [ return [
//'name' => 'required',
'name' => 'required|unique:designs,name,null,null,company_id,'.$user->companyId(), 'name' => 'required|unique:designs,name,null,null,company_id,'.$user->companyId(),
'design' => 'required|array', 'design' => 'required|array',
'design.header' => 'sometimes|string', 'design.header' => 'sometimes|string',

View File

@ -11,6 +11,7 @@
namespace App\Http\Requests\Design; namespace App\Http\Requests\Design;
use App\Models\Account;
use App\Http\Requests\Request; use App\Http\Requests\Request;
use App\Utils\Traits\ChecksEntityStatus; use App\Utils\Traits\ChecksEntityStatus;
@ -20,6 +21,13 @@ class UpdateDesignRequest extends Request
private array $valid_entities = [ private array $valid_entities = [
'invoice', 'invoice',
'payment',
'client',
'quote',
'credit',
'purchase_order',
'project',
'task'
]; ];
/** /**
@ -32,7 +40,7 @@ class UpdateDesignRequest extends Request
/** @var \App\Models\User $user */ /** @var \App\Models\User $user */
$user = auth()->user(); $user = auth()->user();
return $user->isAdmin(); return $user->isAdmin() && $user->account->hasFeature(Account::FEATURE_API);
} }
public function rules() public function rules()