Skip to content

Commit

Permalink
LP-27 feat: permission create name unique rule added
Browse files Browse the repository at this point in the history
  • Loading branch information
hafijul233 committed Oct 1, 2023
1 parent cc823cb commit 77dfe02
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Http/Requests/StorePermissionRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Fintech\Auth\Http\Requests;

use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

Expand All @@ -22,8 +23,10 @@ public function authorize(): bool
*/
public function rules(): array
{
$uniqueRule = 'unique:' . config('fintech.auth.permission_model', \Fintech\Auth\Models\Permission::class) . ',name';

return [
'name' => ['required', 'string', 'min:5', 'max:255'],
'name' => ['required', 'string', 'min:5', 'max:255', $uniqueRule],
'guard_name' => ['required', 'string', Rule::in(array_keys(config('auth.guards', ['web', 'api'])))],
];
}
Expand Down

0 comments on commit 77dfe02

Please sign in to comment.