Skip to content

Commit

Permalink
Task 8. Customize Validation Messages. Done
Browse files Browse the repository at this point in the history
  • Loading branch information
Teon54 committed Aug 4, 2024
1 parent e9553fc commit 0801b84
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/Http/Controllers/BuildingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function create()
// TASK: Customize the validation error message to say "Please enter the name"
public function store(StoreBuildingRequest $request)
{
Building::create($validator->validated());
Building::create($request->validated());

return 'Success';
}
Expand Down
7 changes: 7 additions & 0 deletions app/Http/Requests/StoreBuildingRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,11 @@ public function rules()
'name' => 'required'
];
}

public function messages()
{
return [
'name' => 'Please enter the name',
];
}
}

0 comments on commit 0801b84

Please sign in to comment.