How to make Validation in Laravel 5 -
i using laravel 5. , beginner. in organisationscontroller
have method
public function create() { return view('organisations.create'); }
in routes.php
have
route::model('organisations', 'organisation'); route::resource('organisations', 'organisationscontroller');
in create.blade.php
have code this
<link href="{{ asset('css/style.css') }}" rel="stylesheet"> @extends('app') @section('content') <div class="container-fluid"> <div class="row"> <div class="col-md-8 col-md-offset-2"> <div class="panel panel-default"> <div class="panel-heading">organisation</div> <div class="panel-body"> @if (count($errors) > 0) <div class="alert alert-danger"> <strong>whoops!</strong> there problems input.<br><br> <ul> @foreach ($errors->all() $error) <li>{{ $error }}</li> @endforeach </ul> </div> @endif <!--<form class="form-horizontal" role="form" method="post" action="{{ url('/organisations/store') }}"> --> <form class="form-horizontal" role="form" method="post" action="{{ url('/organisations/store') }}" accept-charset="utf-8"> <input type="hidden" name="_token" value="{{{ csrf_token() }}}"> <div class="form-group"> <label class="col-md-4 control-label">name</label> <div class="col-md-6"> <input type="text" class="form-control" name="name" value="{{ old('name') }}"> </div> </div> <div class="form-group"> <label class="col-md-4 control-label">e-mail</label> <div class="col-md-6"> <input type="email" class="form-control" name="email" value="{{ old('email') }}"> </div> </div> </form> </div> </div> </div> </div> </div> </div>
i need validate email , name field
i don't know write validation. please suggest example this. using laravel 5. have searched many sites. cannot solution this. please tell me write validation code.
you should use formrequest
this: http://laravel.com/docs/5.0/validation#form-request-validation
Comments
Post a Comment