what is wrong in this it is not inserting [duplicate] - mysql

i have a small problem here and it is that the image field doesn't have a default value as the complier said but actually i assigned a value for it i know that this error pops up when the field should have a value but the programmer didn't assign a value to it i know all of this but i already assigned a value to my field so what i am missing here
controller
protected function validator(array $data)
{
return Validator::make($data, [
'name' => ['required', 'string', 'max:255'],
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
'password' => ['required', 'string', 'min:8', 'confirmed'],
'image' => ['required' , 'image' , 'mimes:jpeg,png,jpg', 'max:2048'],
]);
}
protected function create(array $data)
{
$imageName = time().'.'.request()->image->getClientOriginalExtension();
request()->image->move(public_path('images'), $imageName);
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'image' => $imageName,
'password' => Hash::make($data['password']),
]);
}
view
#extends('layouts.app')
#section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Register') }}</div>
<div class="card-body">
<form method="POST" action="{{ route('register') }}" enctype="multipart/form-data">
#csrf
<div class="form-group row">
<label for="name" class="col-md-4 col-form-label text-md-right">{{ __('Name') }}</label>
<div class="col-md-6">
<input id="name" type="text" class="form-control #error('name') is-invalid #enderror" name="name" value="{{ old('name') }}" required autocomplete="name" autofocus>
#error('name')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
#enderror
</div>
</div>
<div class="form-group row">
<label for="email" class="col-md-4 col-form-label text-md-right">{{ __('E-Mail Address') }}</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control #error('email') is-invalid #enderror" name="email" value="{{ old('email') }}" required autocomplete="email">
#error('email')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
#enderror
</div>
</div>
<div class="form-group row">
<label for="password" class="col-md-4 col-form-label text-md-right">{{ __('Password') }}</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control #error('password') is-invalid #enderror" name="password" required autocomplete="new-password">
#error('password')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
#enderror
</div>
</div>
<div class="form-group row">
<label for="password-confirm" class="col-md-4 col-form-label text-md-right">{{ __('Confirm Password') }}</label>
<div class="col-md-6">
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" required autocomplete="new-password">
</div>
</div>
<label class="col-md-4 col-form-label text-md-right" >Upload a picture</label>
<div class="custom-file mb-3 col-sm-6">
<input type="file" class="custom-file-input center" id="image" name="image">
<label class="custom-file-label" for="customFile"></label>
</div>
<div class="form-group row mb-0">
<div class="col-md-6 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Register') }}
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
#endsection
the problem is mainly from the controller but i said that i put the view just in case you want to see it
small note : the image is uploading and it is stored at public folder just like the code said but its name doesn't save at the database also the field image is string at my database because i just want its name so i could view it
snap shot

Set a default image for your image field. Also make sure you have made it fillable, if not set it in protected $fillable in your model User.php
You will get this error when a user doesn't upload an image.
$table->string('image')->default('default.jpg');//You can also add .png
Now have a default image in your storage with name default.jpg
This way the image will have a default value if user doesn't' upload it.

You need to add the default value or make that field null in the migration file, not the controller or view.
$table->string('image')->nullable();
or...
$table->string('image')->default('value');

Related

ErrorException Trying to get property 'id' of non-object - trying to do a register on database

I'm trying to do a "livros" register with a foreign key from user, but when i try to send the information to database this error appear "ErrorException Trying to get property 'id' of non-object" could someone help me?
LIVROCONTROLLER
<?php
namespace App\Http\Controllers;
use Illuminate\Support\Facades\Auth;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\Livro;
class LivroController extends Controller
{
/**
* Display a listing of the resource.
*
* #return \Illuminate\Http\Response
*/
protected $request;
private $repository;
private $livro;
public function __construct(Livro $livro)
{
$this->livro = $livro;
}
public function index()
{
/* $title = 'listagem dos livros';
$livros = $this->livro->all();
return view ('livros/cadastro', compact('livros','title'));*/
return view ('livros/cadastro');
}
protected function validator(Request $request)
{
return Validator::make($request, [
'namel' => ['required', 'string', 'max:200'],
'autor' => ['required', 'string', 'email', 'max:200'],
'editora' => ['required', 'string', 'max:50'],
'categoria'=> ['required', 'string', 'min:50'],
'classificação'=> ['required', 'string', 'min:1','max:2'],
'descricao'=> ['required', 'string', 'min:200'],
'image'=> ['not required'],
]);
}
/**
* Store a newly created resource in storage.
*
* #param \Illuminate\Http\Request $request
* #return \Illuminate\Http\Response
*/
public function create(Request $request)
{
$user = Auth::user()->id;
Livro::create([
'users_id' => $user,
'namel' => $request['namel'],
'autor' => $request['autor'],
'editora' => $request['editora'],
'categoria'=> $request['categoria'],
'classificação'=>$request['classificação'] ,
'descricao'=>$request['descricao'],
'image'=>$request['image'],
]);
return view('livros/cadastro');
}
}
LIVROS MIGRATION TABLE
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateLivrosTable extends Migration
{
/**
* Run the migrations.
*
* #return void
*/
public function up()
{
Schema::create('livros', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('users_id');
$table->foreign('users_id')->references('id')->on('users');
/*Auth::user()->id;*/
$table->text('namel');
$table->string('autor');
$table->string('editora');
$table->string('categoria');
$table->string('classificação');
$table->text('descricao');
$table->string('image')->nullable();
$table->timestamp('created_at')->nullable();
$table->timestamp('updated_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* #return void
*/
public function down()
{
Schema::dropIfExists('livros');
}
}
LIVRO BLADE FILE
#extends('layouts.app')
#section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card" >
<br>
<div class="textocs">
<h4>CADASTRO DE LIVROS</h4>
</div>
<br><br>
<div class="card-body">
<form method="POST" enctype=”multipart/form-data” action="{{ url('/cadastro_livros') }}">
#csrf
<div class="form-group row">
<label for="namel" class="col-md-4 col-form-label text-md-right">{{ __('Nome') }}</label>
<div class="col-md-6">
<input id="namel" type="text" class="form-control #error('namel') is-invalid #enderror" name="namel" value="{{ old('namel') }}" required autocomplete="namel" autofocus>
#error('namel')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
#enderror
<br>
</div>
</div>
<div class="form-group row">
<label for="autor" class="col-md-4 col-form-label text-md-right">{{ __('Autor') }}</label>
<div class="col-md-6">
<input id="autor" type="text" class="form-control #error('autor') is-invalid #enderror" name="autor" value="{{ old('autor') }}" required autocomplete="autor">
#error('autor')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
#enderror
<br>
</div>
</div>
<div class="form-group row">
<label for="editora" class="col-md-4 col-form-label text-md-right">{{ __('editora') }}</label>
<div class="col-md-6">
<input id="editora" type="text" class="form-control #error('editora') is-invalid #enderror" name="editora" value="{{ old('editora') }}" required autocomplete="editora" autofocus>
#error('editora')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
#enderror
<br>
</div>
</div>
<div class="form-group row">
<label for="categoria" class="col-md-4 col-form-label text-md-right">{{ __('categoria') }}</label>
<div class="col-md-6">
<input id="categoria" type="text" class="form-control #error('categoria') is-invalid #enderror" name="categoria" value="{{ old('categoria') }}" required autocomplete="categoria" autofocus>
#error('categoria')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
#enderror
<br>
</div>
</div>
<div class="form-group row">
<label for="classificação" class="col-md-4 col-form-label text-md-right">{{ __('classificação (1-10)') }}</label>
<div class="col-md-6">
<input id="classificação" type="number" maxlength="2" class="form-control #error('classificação') is-invalid #enderror" name="classificação" value="{{ old('classificação') }}" required autocomplete="classificação" autofocus>
#error('classificação')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
#enderror
<br>
</div>
</div>
<div class="form-group row">
<label for="descricao" class="col-md-4 col-form-label text-md-right">{{ __('descricao') }}</label>
<div class="col-md-6">
<input id="descricao" type="text" class="form-control #error('descricao') is-invalid #enderror" name="descricao" value="{{ old('descricao') }}" required autocomplete="descricao" autofocus>
#error('descricao')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
#enderror
<br>
</div>
</div>
<div class="form-group row">
<label for="image" class="col-md-4 col-form-label text-md-right">{{ __('imagem') }}</label>
<div class="col-md-6">
<input type="file" class="form-control #error('image') is-invalid #enderror" name="image" value="{{ old('image') }}" required autocomplete="image" autofocus>
#error('image')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
#enderror
<br>
</div>
</div>
<br><br>
<button type="submit" class="btn btn-primary">
{{ __('Cadastrar') }}
</button>
</form>
</div>
</div>
</div>
</div>
</div>
#endsection
ROUTE TO THE REGISTER "LIVROS"
Route::get('/cad_livros', [App\Http\Controllers\LivroController::class, 'index']);
Route::post('/cadastro_livros',[App\Http\Controllers\LivroController::class, 'create']);
I think you are not logged-in and inside your create method you are trying to get the id of Auth::user() which is null, so you get that error.
If this create requires the user to login, protect your route with auth middleware.
Route::post(
'/cadastro_livros',
[App\Http\Controllers\LivroController::class, 'create']
)->middleware('auth');

Image is not saving on my public path - laravel

im trying to save a profile image on a register blade, the images are going to database with the name but couldn't be save on my public/imgs repository, so i can't even show on a view. Can someone help me to resolve this problem? the name of the image on my database is "foto".
public function store
public function store(StoreUpdatePost $request)
{
$data = $request->all();
if($request->foto('foto')->isValid()){
$file = $request->foto->storeAs('public/users',$nameFile);
$file = str_replace('public/','app/',$file);
$data['foto'] = $file;
}
User::create($data);
//foto upload
if($request->hasFile('foto') && $request->file('foto')->isValid()){
$requestFoto = $request->foto;
$extension = $requestFoto->extension();
$fotoName = md5($requestFoto->getClientOriginalName() . strtotime("now")) . "." . $extension;
$request->foto->move(public_path('imgs\users'), $fotoName);
$data->foto = $fotoName;
$data->save();
}
}
VIEW REGISTER BLADE
#extends('layouts.app')
#section('content')
<div class="container"><!---->
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card" >
<br>
<div class="textocs">
<h4>CADASTRE-SE</h4>
</div>
<br><br>
<div class="card-body">
<form method="POST" enctype=”multipart/form-data” action="{{ route('register') }}">
#csrf
<div class="form-group row">
<label for="name" class="col-md-4 col-form-label text-md-right">{{ __('Nome') }}</label>
<div class="col-md-6">
<input id="name" type="text" class="form-control #error('name') is-invalid #enderror" name="name" value="{{ old('name') }}" required autocomplete="name" autofocus>
#error('name')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
#enderror
<br>
</div>
</div>
<div class="form-group row">
<label for="email" class="col-md-4 col-form-label text-md-right">{{ __('E-mail:') }}</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control #error('email') is-invalid #enderror" name="email" value="{{ old('email') }}" required autocomplete="email">
#error('email')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
#enderror
<br>
</div>
</div>
<div class="form-group row">
<label for="password" class="col-md-4 col-form-label text-md-right">{{ __('Senha:') }}</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control #error('password') is-invalid #enderror" name="password" required autocomplete="new-password">
#error('password')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
#enderror
<br>
</div>
</div>
<div class="form-group row">
<label for="password-confirm" class="col-md-4 col-form-label text-md-right">{{ __('Redigite a senha:') }}</label>
<div class="col-md-6">
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" required autocomplete="new-password">
</div>
<br>
</div><br>
<div class="form-group row">
<label for="cidade" class="col-md-4 col-form-label text-md-right">{{ __('Cidade') }}</label>
<div class="col-md-6">
<input id="cidade" type="text" class="form-control #error('cidade') is-invalid #enderror" name="cidade" value="{{ old('cidade') }}" required autocomplete="cidade" autofocus>
#error('cidade')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
#enderror
<br>
</div>
</div>
<div class="form-group row">
<label for="numero" class="col-md-4 col-form-label text-md-right">{{ __('Número') }}</label>
<div class="col-md-6">
<input id="numero" type="number" class="form-control #error('numero') is-invalid #enderror" name="numero" value="{{ old('numero') }}" required autocomplete="numero" autofocus>
#error('numero')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
#enderror
<br>
</div>
</div>
<div class="form-group row">
<label for="foto" class="col-md-4 col-form-label text-md-right">{{ __('Foto') }}</label>
<div class="col-md-6">
<label for="foto">Foto:</label>
<input type="file" class="form-control-file" name="foto" >
<br>
</div>
</div>
<br><br>
<button type="submit" class="btn btn-primary">
{{ __('Cadastrar') }}
</button>
</form>
</div>
</div>
</div>
</div>
</div>
#endsection
MIGRATION TO ADD FIELDS ON USERS TABLE
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddCamposTableUsers extends Migration
{
/**
* Run the migrations.
*
* #return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->string('cidade');
$table->string('numero');
$table->string('foto')->nullable();
});
}
/**
* Reverse the migrations.
*
* #return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
Schema::dropIfExists('users');
});
}
}

Registering form is not storing data in database

Well I am using this form to register a user in database but It is not successfully being storing data. While RegisterContoller.php is in Auth section. And I have given route: Auth::routes();. But still I why it is not storing data.
Register.blade.php
<form style="margin-left: 30%; margin-right: 30%; margin-top: 5%;" class="form-horizontal" method="POST" action="{{ route('register') }}">
{{ csrf_field() }}
<div class="form-group organic-form-2 {{ $errors->has('name') ? ' has-error' : '' }}">
<label for="name">Your Name *</label>
<input id="name" class="form-control" type="text" name="name" value="{{ old('name') }}" required autofocus>
#if ($errors->has('name'))
<span class="help-block">
<strong>{{ $errors->first('name') }}</strong>
</span>
#endif
</div>
<div class="form-group organic-form-2 {{ $errors->has('email') ? ' has-error' : '' }}">
<label for="email">Your Email *</label>
<input id="email" class="form-control" type="email" name="email" value="{{ old('email') }}" required>
</div>
<div class="form-group organic-form-2">
<label>Password *</label>
<input class="form-control" type="Password">
</div>
<div class="form-group organic-form-2">
<label>Repeat Password *</label>
<input class="form-control" type="Password">
</div>
<div class="form-group remember-me">
<div class="checkbox pull-left">
<label>
<input type="checkbox" name="value1"> Privacy Policy Agreement?
</label>
</div>
</div>
<div class="form-group footer-form">
<button class="btn btn-brand pill" type="submit">SUBMIT</button>
</div>
</form>
</div>
</div>
</div>
</section>
</div>
RegisterController.php
protected function validator(array $data)
{
return Validator::make($data, [
'name' => 'required|string|max:255',
'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|min:6|confirmed',
]);
}
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
]);
}
}
It seems you miss input names in your form.
Instead of:
<div class="form-group organic-form-2">
<label>Password *</label>
<input class="form-control" type="Password">
</div>
<div class="form-group organic-form-2">
<label>Repeat Password *</label>
<input class="form-control" type="Password">
</div>
use:
<div class="form-group organic-form-2">
<label>Password *</label>
<input class="form-control" type="Password" name="password">
</div>
<div class="form-group organic-form-2">
<label>Repeat Password *</label>
<input class="form-control" type="Password" name="password_confirmation">
</div>

Laravel 5.4 UnexpectedValueException in Response.php line 444 in form submition

I am making multiauth. When I submit admin email and password from admin login view I got bellow error
"UnexpectedValueException in Response.php line 444:
The Response content must be a string or object implementing __toString(), "boolean" given."
here is my form
#extends('layouts.app')
#section('content')
<div class="container">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">Admin Login</div>
<div class="panel-body">
<form class="form-horizontal" role="form" method="POST" action="{{ route('admin.login.submit') }}">
{{ csrf_field() }}
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
<label for="email" class="col-md-4 control-label">E-Mail Address</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required autofocus>
#if ($errors->has('email'))
<span class="help-block">
<strong>{{ $errors->first('email') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
<label for="password" class="col-md-4 control-label">Password</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control" name="password" required>
#if ($errors->has('password'))
<span class="help-block">
<strong>{{ $errors->first('password') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<div class="checkbox">
<label>
<input type="checkbox" name="remember" {{ old('remember') ? 'checked' : '' }}> Remember Me
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-8 col-md-offset-4">
<button type="submit" class="btn btn-primary">
Login
</button>
<a class="btn btn-link" href="{{ route('password.request') }}">
Forgot Your Password?
</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
#endsection
And here is route
Route::prefix('admin')->group(function (){
Route::post('/login', 'Auth\AdminLoginController#login')->name('admin.login.submit');
});
And the controller is here
<?php
namespace App\Http\Controllers\Auth;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
class AdminLoginController extends Controller
{
public function __construct()
{
$this->middleware('guest');
}
public function showLoginForm()
{
return view('admin.auth.login');
}
public function login(Request $request)
{
return true;
}
}
What wrong here?
And How can I solve it?
Thanks in advance.
I found that problem. that was in my controller. Exactly in login function. I returened true. Here is the problem. When I return 1 then it worked.

Laravel : Form not submitting but everything looks right?

I have a very strange problem with Laravel . I'm sure I miss something but not sure what.
When submit there's no record in DB. But it's very strange that not submit even without validator. Here is the code.
The model:
use Illuminate\Auth\UserTrait;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableTrait;
use Illuminate\Auth\Reminders\RemindableInterface;
class Registration extends Eloquent implements UserInterface, RemindableInterface {
use UserTrait, RemindableTrait;
/**
* The database table used by the model.
*
* #var string
*/
protected $table = 'register';
protected $fillable = array('first_name','middle_name','last_name','address','phone','email','age','growth','weight','shoe_size','cloth_size','languages','eye_color');
}
The Controller :
<?php
class RegistrationController extends BaseController {
public function getAgency() {
return View::make('agency');
}
public function postAgency(){
$rules = array(
'first_name' => 'required',
'middle_name' => 'required',
'last_name' =>'required',
'address' => 'required',
'phone' => 'required',
'email' => 'required|email',
'age' => 'required',
'growth' =>'required',
'weight' => 'required',
'shoe_size' => 'required',
'cloth_size' => 'required',
'languages' => 'required',
'eye_color' => 'required'
);
$validator = Validator::make(Input::all(),$rules);
if ($validator->fails()) {
return Redirect::to('/agency')->withErrors($validator)->withInput();
}
else {
$registration = new Registration;
$registration->first_name = Input::get('first_name');
$registration->middle_name = Input::get('middle_name');
$registration->last_name = Input::get('last_name');
$registration->address = Input::get('address');
$registration->phone = Input::get('phone');
$registration->email = Input::get('email');
$registration->age = Input::get('age');
$registration->growth = Input::get('growth');
$registration->weight = Input::get('weight');
$registration->shoe_size = Input::get('shoe_size');
$registration->cloth_size = Input::get('cloth_size');
$registration->languages = Input::get('languages');
$registration->eye_color = Input::get('eye_color');
$registration->save();
return Redirect::to('/agency')->with('global',"Thank You!");
}
}
}
The View (agency.blade.php):
#extends('layouts.main')
#section('content')
<div class="container">
<div class="stepwizard">
<div class="stepwizard-row setup-panel">
<div class="stepwizard-step">
1
<p><img src="images/leftShoe.png" alt="" class="shoes"></p>
</div>
<div class="stepwizard-step">
2
<p><img src="images/rightShoe.png" alt="" class="shoes"></p>
</div>
<div class="stepwizard-step">
3
<p><img src="images/duoShoes.png" alt="" class="shoes"></p>
</div>
</div>
</div>
<form method="POST" action="{{URL::action('agency-post')}}">
<div class="row setup-content" id="step-1">
<div class="col-md-12">
<button class="btn btn-primary nextBtn btn-lg pull-right" type="button" >Next</button>
</div>
</div>
<div class="row setup-content" id="step-2">
<div class="col-xs-12">
<div class="col-md-12">
<div class="form-group">
<label>First Name</label>
<input type="text" id="name" class="form-control" name="first_name" placeholder="First Name">
#if ($errors->has('first_name')) <p class="help-block">{{ $errors->first('first_name') }}</p> #endif
</div>
<div class="form-group">
<label >Middle Name</label>
<input type="text" id="name" class="form-control" name="middle_name" placeholder="Middle Name">
#if ($errors->has('middle_name')) <p class="help-block">{{ $errors->first('middle_name') }}</p> #endif
</div>
<div class="form-group">
<label >Last Name</label>
<input type="text" id="name" class="form-control" name="last_name" placeholder="Last Name">
#if ($errors->has('last_name')) <p class="help-block">{{ $errors->first('last_name') }}</p> #endif
</div>
<div class="form-group">
<label >Address</label>
<input type="text" id="name" class="form-control" name="address" placeholder="Address">
#if ($errors->has('address')) <p class="help-block">{{ $errors->first('address') }}</p> #endif
</div>
<div class="form-group">
<label >Phone</label>
<input type="text" id="name" class="form-control" name="phone" placeholder="Phone">
#if ($errors->has('phone')) <p class="help-block">{{ $errors->first('phone') }}</p> #endif
</div>
<div class="form-group">
<label >Email</label>
<input type="email" id="email" class="form-control" name="email" placeholder="super#cool.com">
#if ($errors->has('email')) <p class="help-block">{{ $errors->first('email') }}</p> #endif
</div>
<div class="form-group">
<label >Age</label>
<input type="text" id="email" class="form-control" name="age" placeholder="Age">
#if ($errors->has('age')) <p class="help-block">{{ $errors->first('age') }}</p> #endif
</div>
<div class="form-group">
<label >Growth</label>
<input type="text" id="email" class="form-control" name="growth" placeholder="Growth">
#if ($errors->has('growth')) <p class="help-block">{{ $errors->first('growth') }}</p> #endif
</div>
<div class="form-group">
<label >Weight</label>
<input type="text" id="email" class="form-control" name="weight" placeholder="Weight">
#if ($errors->has('weight')) <p class="help-block">{{ $errors->first('weight') }}</p> #endif
</div>
<div class="form-group">
<label >Shoe size</label>
<input type="text" id="email" class="form-control" name="shoe_size" placeholder="Shoe size">
#if ($errors->has('shoe_size')) <p class="help-block">{{ $errors->first('shoe_size') }}</p> #endif
</div>
<div class="form-group">
<label >Size Clothing</label>
<input type="text" id="email" class="form-control" name="cloth_size" placeholder="Cloth Size">
#if ($errors->has('cloth_size')) <p class="help-block">{{ $errors->first('cloth_size') }}</p> #endif
</div>
<div class="form-group">
<label >Spoken Languages</label>
<input type="text" id="email" class="form-control" name="languages" placeholder="Spoken Languages">
#if ($errors->has('languages')) <p class="help-block">{{ $errors->first('languages') }}</p> #endif
</div>
<div class="form-group">
<label >Eye Color</label>
<input type="text" id="email" class="form-control" name="eye_color" placeholder="Eye Color">
#if ($errors->has('eye_color')) <p class="help-block">{{ $errors->first('eye_color') }}</p> #endif
</div>
<div class="form-group">
<button class="btn btn-primary nextBtn btn-lg pull-right" type="button" >Next</button>
</div>
</div>
</div>
<div class="row setup-content" id="step-3">
<div class="col-xs-12">
<div class="col-md-12">
<h3> Additional Information</h3>
<div class="form-group">
<label class="control-label">Skills</label>
<textarea maxlength="500" class="form-control" rows="5" placeholder="Enter your skills"></textarea>
</div>
<div class="form-group">
<label class="control-label">Additional Information</label>
<textarea maxlength="500" type="text" class="form-control" rows="5" placeholder="Enter additional information for you"></textarea>
</div>
{{Form::token()}}
{{Form::submit('Finish!')}}
</div>
</div>
</div>
Route.php
Route::get('/agency',array(
'as' => 'agency',
'uses' => 'RegistrationController#getAgency'
));
Route::post('/agency',array(
'as' => 'agency-post',
'uses' => 'RegistrationController#postAgency'
));
It's more strange that when write in loop $validator->fails() { return 'fails';}
page only reload nothing happens.