2018年3月7日 星期三

laravel validations

//Controller
$validator = Validator::make($request->all(), [
'name' => 'required|max:255'
        ],
        [
            'name.required' => '請輸入名稱!',
        ]);

if ($validator->fails()) {
return back()->withErrors($validator)->withInput();
        }

//blade
@if ($errors->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif



//api validation
$this->validate($request, [
             'is_important' => 'required',
         ]);

[CentOS] httpd port 9000 to 80

<VirtualHost *:80>     ServerName domain.name     ProxyRequests Off     ProxyVia Block     ProxyPreserveHost On     <Proxy *...