mirror of
https://github.com/10h30/Test-Laravel-Validation.git
synced 2026-06-05 15:07:56 +09:00
25 lines
542 B
PHP
25 lines
542 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Controllers;
|
||
|
|
|
||
|
|
use App\Http\Requests\StoreBuildingRequest;
|
||
|
|
use App\Models\Building;
|
||
|
|
use Illuminate\Http\Request;
|
||
|
|
use Illuminate\Support\Facades\Validator;
|
||
|
|
|
||
|
|
class BuildingController extends Controller
|
||
|
|
{
|
||
|
|
public function create()
|
||
|
|
{
|
||
|
|
return view('buildings.create');
|
||
|
|
}
|
||
|
|
|
||
|
|
// TASK: Customize the validation error message to say "Please enter the name"
|
||
|
|
public function store(StoreBuildingRequest $request)
|
||
|
|
{
|
||
|
|
Building::create($validator->validated());
|
||
|
|
|
||
|
|
return 'Success';
|
||
|
|
}
|
||
|
|
}
|