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
Hoàng Văn Tuyến committed Oct 17, 2023
1 parent d405384 commit e33b370
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.required' => 'Please enter the name'
];
}
}

0 comments on commit e33b370

Please sign in to comment.