Skip to content

Commit

Permalink
refactor(bank): Save bank validation
Browse files Browse the repository at this point in the history
- Adding composer extra validation for BIC, IBAN
  • Loading branch information
gnovaro committed Mar 3, 2024
1 parent d2ddd9d commit 8fb763a
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 1 deletion.
9 changes: 9 additions & 0 deletions app/Http/Controllers/Bank/BankSaveController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,20 @@
use App\Models\Bank;
use Illuminate\Http\Request;
use Ramsey\Uuid\Uuid;
use Intervention\Validation\Rules\Bic;

class BankSaveController
{
public function save(Request $request)
{
$request->validate([
'name' => 'required',
'country_id' => 'required',
'bic' => 'required|bic|unique:bank',
'email' => 'nullable|email',
'website' => 'nullable|url',
]);

if (empty($request->uuid)) {
$bank = new Bank();
$bank->created_at = now();
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"h4cc/wkhtmltoimage-i386": "0.12.x",
"h4cc/wkhtmltopdf-amd64": "0.12.x",
"h4cc/wkhtmltopdf-i386": "0.12.x",
"intervention/validation": "^4.1",
"laravel/framework": "^10.10",
"laravel/helpers": "^1.6",
"laravel/sanctum": "^3.3",
Expand Down
86 changes: 85 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8fb763a

Please sign in to comment.