I'm creating a file called edit.blade to edit users.
The problem is, when i'm trying to make a list with all roles, Laravel prints the following error:
Undefined variable: roles (View: /home/ubuntu/workspace/resources/views/user/edit.blade.php)
Here is my edit.blade template:
#extends ('adminlte::page')
#section('content')
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.css">
<div class="container" style="margin-left:25%">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-heading">
<h2>Editar datos del Usuario</h2>
</div>
<div class="panel-body">
<form class="form-horizontal" method="POST" action="{{ route('user.update', ['user' => $user->id]) }}">
{{ csrf_field() }}
<input type="hidden" name="_method" value="PUT"/>
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
<label for="name" class="col-md-4 control-label">
Nombre
</label>
<div class="col-md-6">
<input id="name" type="text" class="form-control" name="name" value="{{ $user->name }}" autofocus style=" ">
#if ($errors->has('name'))
<span class="help-block">
<strong style=" ">{{ $errors->first('name') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
<label for="email" class="col-md-4 control-label">
Email
</label>
<div class="col-md-6">
<input id="email" type="text" class="form-control" name="email" value="{{ $user->email }}" autofocus style=" ">
#if ($errors->has('email'))
<span class="help-block">
<strong style=" ">{{ $errors->first('email') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group">
<label for="club" class="col-md-4 control-label">
Club
</label>
<div class="col-md-6">
<select name="id_club" >
#foreach($clubs as $club)
<option value="{{$club->id_club}}" class="form-control">{{$club->nombre}}</option>
#endforeach
</select>
</div>
</div>
<div class="form-group">
<label for="roles" class="col-md-4 control-label">
Rol
</label>
<div class="col-md-6">
<select name="role_id" >
#foreach($roles as $role)
<option value="{{$role->id}}" class="form-control">{{$role->name}}</option>
#endforeach
</select>
</div>
</div>
<div class="form-group">
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary">Guardar</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
#endsection
And my this is my UserController that calls the blade template with the relevant variables:
public function edit(User $user)
{
$roles = Role::all();
$clubs = Club::all();
return view('user.edit', ['user' => $user], ['clubs' => $clubs], ['roles' => $roles]);
}
/**
* Update the specified resource in storage.
*
* #param \Illuminate\Http\Request $request
* #param \App\User $user
* #return \Illuminate\Http\Response
*/
public function update(Request $request, User $user)
{
$user->save();
$user->roles()->sync([$request->input('role_id')]);
//$user->update($request->all());
return redirect()->route('user.index');
}
I'm including use App\Role; at the top of this file.
Change this:
return view('user.edit', ['user' => $user], ['clubs' => $clubs], ['roles' => $roles]);
to this:
return view('user.edit', ['user' => $user, 'clubs' => $clubs, 'roles' => $roles]);
The view() accepts the data you want to send to the view as an array as a second param.
You can also use view(...)->with(compact('user', 'clubs', 'roles'))
Related
I used hyn/tenancy https://tenancy.dev/docs/hyn/5.4 and created an application like this: https://www.seismicpixels.com/creating-a-laravel-saas-framework-part-6/
At the moment I'm having the problem that I'm trying to setup a registration controller for users within the tenant. I tried doing this with a second public function in the registration controller
protected function createuser(array $data)
{
print_r($data);
die();
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => Hash::make($data['password']),
]);
}
The showRegistrationForm() function is:
/**
* Show the application registration form.
*
* #return \Illuminate\Http\Response
*/
public function showRegistrationForm()
{
return view('auth.registeruser');
}
The error I'm facing is (as far as i do understand), says that there's no array, which could be selected as $data . I tried using the die() like above but array $data isn't going through.
I also tried using the standard registration page which is
#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">Register</div>
<div class="panel-body">
<form class="form-horizontal" role="form" method="POST" action="{{ route('register.users') }}">
{{ csrf_field() }}
<div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
<label for="name" class="col-md-4 control-label">Name</label>
<div class="col-md-6">
<input id="name" type="text" class="form-control" name="name" value="{{ old('name') }}" required autofocus>
#if ($errors->has('name'))
<span class="help-block">
<strong>{{ $errors->first('name') }}</strong>
</span>
#endif
</div>
</div>
<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>
#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">
<label for="password-confirm" class="col-md-4 control-label">Confirm Password</label>
<div class="col-md-6">
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" required>
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-primary">
Register
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
#endsection
and here's my web.php where the registration routes are shown, but I don't think the problem is within here because i'm getting an error out of the function, so the routing works?
// Register Routes
Route::get('register', 'Auth\RegisterUserController#showRegistrationForm')->name('register.user');
Route::post('registeruser', 'Auth\RegisterController#createuser')->name('register.users');
I hope somebody can help me with this error (probably on my side 🙈)
Thanks in advance!
Try This:
protected function createuser(Request $request)
{
print_r($request->name);
die();
return User::create([
'name' => $request->name,
'email' => $request->email,
'password' => Hash::make($request->password),
]);
}
You are passing the $data as parameter but not definig it in you route:
try this hope it will help you!
Your registers.users should use Auth\RegisterController#register method. createuser is called inline and receives $request->all()
Btw, default name for the function is create(), no createuser (if you don't want to modify register method)
I've got problem with dropdown list.
i want to show a primary key as a dropdown list in view blade , but i can not make the right rout to show it. Have you any ideas how to solve this problem?
this my root
$objects = ['users', 'permissions', 'roles', 'coins','pillars','subtindicators'];
foreach ($objects as $object) {
Route::get("$object", ucfirst(str_singular($object))."Controller#index")->middleware("permission:browse $object")->name("{$object}");
Route::get("$object/datatable", ucfirst(str_singular($object))."Controller#datatable")->middleware("permission:browse $object")->name("{$object}.datatable");
Route::get("$object/add", ucfirst(str_singular($object))."Controller#add")->middleware("permission:add $object")->name("{$object}.add");
Route::post("$object/create", ucfirst(str_singular($object))."Controller#create")->middleware("permission:add $object")->name("{$object}.create");
Route::get("$object/{id}/edit", ucfirst(str_singular($object))."Controller#edit")->middleware("permission:edit $object")->name("{$object}.edit");
Route::post("$object/{id}/update", ucfirst(str_singular($object))."Controller#update")->middleware("permission:edit $object")->name("{$object}.update");
Route::get("$object/{id}/delete", ucfirst(str_singular($object))."Controller#delete")->middleware("permission:delete $object")->name("{$object}.delete");
Route::get("$object/{id}", ucfirst(str_singular($object))."Controller#view")->middleware("permission:view $object")->name("{$object}.view");
Route::get("$object/create", ucfirst(str_singular($object))."Controller#list")->middleware("permission:add $object")->name("{$object}.create");
this my controller
public function add()
{ $strs = DB::table('stargets')->select('*')->get();;
return view('subtindicators.add-edit',compact('strs'));
}
public function update(Request $request, $id)
{
$object = $this->objectModel::find($id);
$object->update([
'skey_name' => $request->skey_name,
'Subtarget_base' => $request->Subtarget_base,
'Subtarget_end' => $request->Subtarget_end,
'subtarget_id' => $request->subtarget_id
]);
if ($request->save == 'browse')
return redirect()->route("{$this->objectName}");
elseif ($request->save == 'edit')
return redirect()->route("{$this->objectName}.edit", ['id' => $object]);
elseif ($request->save == 'add')
return redirect()->route("{$this->objectName}.add");
else
return redirect($request->previous_url);
}
this my blade
#extends('adminlte::page')
#include('bread.title')
#section('main-content')
<div class="container-fluid spark-screen">
<div class="row">
{!! csrf_field() !!}
<form class="form-horizontal" action="{{$actionName=='edit'?route("{$objectName}.update",['id'=>$object->id]):route("{$objectName}.create") }}" method="post">
{!! csrf_field() !!}
<input type="hidden" name="previous_url" value="{{ url()->previous() }}">
<form class="form-horizontal" action="{{ $actionName == 'edit' ? route("{$objectName}.update", ['id' => $object->id]) : route("{$objectName}.create") }}" method="post">
{!! csrf_field() !!}
<input type="hidden" name="previous_url" value="{{ url()->previous() }}">
<div class="box box-solid">
<div class="box-header with-border">
<h3 class="box-title">{{ ucfirst($actionName) }} {{ ucfirst($objectName) }} {{ !empty($object) ? "(ID $object->id)" : '' }}</h3>
<div class="box box-solid">
<div class="box-header with-border">
<h3 class="box-title">{{ ucfirst($actionName) }} {{ ucfirst($objectName) }} {{ !empty($object) ? "(ID $object->id)" : '' }}</h3>
<div class="box-tools pull-right">
<button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
</div>
</div>
</div>
<div class="box-body">
<div class="form-group">
<label for="" class="col-md-2 control-label">col</label>
<div class="col-md-10">
<input type="text" name="skey_name" class="form-control" maxlength="255" value="{{ !empty($object) ? $object->coin_arname : '' }}" required>
</div>
</div>
<div class="form-group">
<label for="" class="col-md-2 control-label">cl_d</label>
<div class="col-md-10">
<input type="text" name="Subtarget_base" class="form-control" maxlength="255" value="{{ !empty($object) ? $object->coin_enname : '' }}" required>
</div>
</div>
<div class="form-group">
<label for="" class="col-md-2 control-label">cl_e</label>
<div class="col-md-10">
<input type="text" name="Subtarget_end" class="form-control" maxlength="255" value="{{ !empty($object) ? $object->coin_arsymbol : '' }}" required>
</div>
</div>
<div class="form-group">
<label for="" class="form-control">c_i</label>
<div class="col-md-10">
<select class="form-control" name="starget_id">
<option selected disabled value = " ">choos</option>
#foreach($strs as $vis)
<option value="{{$vis->id}}">{{$vis->target_name}}</option>
#endforeach
<!-- <p class="form-control-static">{{ $object->subtarget_id }}</p>-->
</div>
</div>
<div class="form-group has-feedback">
<label for="title">main<span class="text-danger">*</span></label>
<select class="form-control" name="starget_id">
<option selected disabled value = " ">choos</option>
#foreach($strs as $slider2)
<option value="{{$slider2->id}}" {{ $slider2->id== $slider->starget_id ? 'selected' : '' }}>{{$slider2->vname}}</option>
#endforeach
</div>
</div>
</div>
<div class="box-footer">
#include('bread.add-edit-actions')
</div>
</div>
</form> </form>
</div>
</div>
</div>
#endsection
this error what i got
ErrorException (E_ERROR)
Undefined variable: actionName (View: C:\project Last\resources\views\bread\title.blade.php) (View: C:\Ministry Last\resources\views\bread\title.blade.php)
You should forward $actionName variable to your view:
public function add()
{
$strs = DB::table('stargets')->select('*')->get();
$actionName = 'edit';
return view('subtindicators.add-edit',compact('strs', 'actionName'));
}
However this will hardcode the form to being an "edit" form. You must see what you really want with your logic.
I created a registration form using make:auth command in Laravel 5.5. Its working alright but not showing errors when validation fails. I've checked many times that code to display errors exists in template but still getting this error.
Template Location:
resources/views/mybladetemplate
Method in Controller:
protected function validator(array $data)
{
return Validator::make($data, [
'field1' => 'required|string|max:255',
'emailField' => 'required|string|email|max:255|unique:users',
'fieldPwd' => 'required|string|min:6|confirmed',
'anotherfield' => 'string'
]);
}
RegistersUsers Trait:
public function register(Request $request)
{
$this->validator($request->all())->validate();
event(new Registered($user = $this->create($request->all())));
$this->guard()->login($user);
return $this->registered($request, $user)
?: redirect($this->redirectPath());
}
Registeration Form:
<form class="form-horizontal" method="POST" action="{{ route('register') }}">
{{ csrf_field() }}
<div class="form-group{{ $errors->has('field1') ? ' has-error' : '' }}">
<label for="name" class="col-md-4 control-label">Field Name</label>
<div class="col-md-6">
<input id="field1" type="text" class="form-control" name="field" value="{{ old('field1') }}" required autofocus>
#if ($errors->has('field1'))
<span class="help-block">
<strong>{{ $errors->first('field1') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group{{ $errors->has('emailField') ? ' has-error' : '' }}">
<label for="email" class="col-md-4 control-label">E-Mail Address</label>
<div class="col-md-6">
<input id="emailField" type="email" class="form-control" name="emailField" value="{{ old('emailField') }}" required>
#if ($errors->has('emailField'))
<span class="help-block">
<strong>{{ $errors->first('emailField') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group">
<label for="anotherfield" class="col-md-4 control-label">Another Field</label>
<div class="col-md-6">
<input id="anotherfield" type="text" class="form-control" name="anotherfield" value="{{ old('anotherfield') }}" />
</div>
</div>
<div class="form-group{{ $errors->has('fieldPwd') ? ' has-error' : '' }}">
<label for="fieldPwd" class="col-md-4 control-label">Password</label>
<div class="col-md-6">
<input id="fieldPwd" type="password" class="form-control" name="fieldPwd" required>
#if ($errors->has('fieldPwd'))
<span class="help-block">
<strong>{{ $errors->first('fieldPwd') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group">
<label for="password-confirm" class="col-md-4 control-label">Confirm Password</label>
<div class="col-md-6">
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" required>
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-primary">
Register
</button>
</div>
</div>
</form>
Use this simple code in your blade to show all of the errors in a ul li structure :
#if($errors->any())
#foreach ($errors->all() as $error)
<div class="alert alert-warning" dir="rtl">
<ul>
<li>{!! $error !!}</li>
</ul>
</div>
#endforeach
#endif
I'm following a tutorial about Authorization in laravel, but it seems it got some errors in the code like this:
"Type error: Argument 2 passed to App\Providers\AuthServiceProvider::App\Providers\{closure}() must be an instance of App\Providers\Post, instance of App\Post given, called in E:\xampp\htdocs\cms\vendor\laravel\framework\src\Illuminate\Auth\Access\Gate.php on line 323 â—€"
I got those error code when I'm accessing http://cms.dev/posts/edit/2. here's the code that i've put on AuthServicesProfider:
public function registerPostPolicies()
{
Gate::define('create-post', function ($user) {
return $user->hasAccess(['create-post']);
});
Gate::define('update-post', function ($user, Post $post) {
return $user->hasAccess(['update-post']) or $user->id == $post->user_id;
});
Gate::define('publish-post', function ($user) {
return $user->hasAccess(['publish-post']);
});
Gate::define('see-all-drafts', function ($user) {
return $user->inRole('editor');
});
}
and here's the code for the update.blade:
#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">Update Post</div>
<div class="panel-body">
<form class="form-horizontal" role="form" method="POST" action="{{ route('update_post', ['post' => $post->id]) }}">
{{ csrf_field() }}
<div class="form-group{{ $errors->has('title') ? ' has-error' : '' }}">
<label for="title" class="col-md-4 control-label">Title</label>
<div class="col-md-6">
<input id="title" type="text" class="form-control" name="title" value="{{ old('title', $post->title) }}" required autofocus>
#if ($errors->has('title'))
<span class="help-block">
<strong>{{ $errors->first('title') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group{{ $errors->has('body') ? ' has-error' : '' }}">
<label for="body" class="col-md-4 control-label">Body</label>
<div class="col-md-6">
<textarea name="body" id="body" cols="30" rows="10" class="form-control" required>{{ old('body', $post->body) }}</textarea>
#if ($errors->has('body'))
<span class="help-block">
<strong>{{ $errors->first('body') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-primary">
Update
</button>
#can('publish-post')
<a href="{{ route('publish_post', ['post' => $post->id]) }}" class="btn btn-primary">
Publish
</a>
#endcan
<a href="{{ route('list_posts') }}" class="btn btn-primary">
Cancel
</a>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
#endsection
I really have no idea about how to fix it since i really don't understand about authorization in Laravel. Thanks.
You're missing a use statement for the Post class, therefore PHP assumes the gate takes the Post class from the current namespace, hence the App\Providers\Post in the error message.
Add the following in the provider class:
use App\Post;
I'm working on laravel 5.4 i have 3 type of users and all of them working perfectly, 1 of them of course is admin and the 2 other is users and companies, users are using auth default login nd register form and there is no issue on that, what my issue is for companies to register i need a new form I made a blade for companies registration form and register controller for them in app/http/auth folder now form will loading and when I try to save the form it returns me this error:
FatalThrowableError in CompanyRegisterController.php line 54: Type error: Too few arguments to function App\Http\Controllers\Auth\CompanyRegisterController::create(), 0 passed and exactly 1 expected
My line 54 is:
protected function create(array $data)
this is my complete companyregistercontroller:
<?php
namespace App\Http\Controllers\Auth;
use Illuminate\Http\Request;
use App\User;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Validator;
use Illuminate\Foundation\Auth\RegistersUsers;
class CompanyRegisterController extends Controller
{
/**
* Where to redirect users after registration.
*
* #var string
*/
protected $redirectTo = 'companies';
public function __construct() {
$this->middleware('guest:company');
}
protected function index()
{
return view('auth.company-register');
}
/**
* Get a validator for an incoming registration request.
*
* #param array $data
* #return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'company_name' => 'required|string|max:255',
'manager_name' => 'required|string|max:255',
'address' => 'required|string|max:255',
'username' => 'required',
'email' => 'required|string|email|max:255|unique:users',
'about' => 'sometimes|min:10|max:2000',
'password' => 'required|string|min:6|confirmed',
]);
}
/**
* Create a new user instance after a valid registration.
*
* #param array $data
* #return User
*/
protected function create(array $data)
{
return Company::create([
'company_name' => $data['company_name'],
'manager_name' => $data['manager_name'],
'address' => $data['address'],
'username' => $data['username'],
'about' => $data['about'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
]);
}
}
UPDATE
My view codes
#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">Companies Register form <span style="float:right;" data-toggle="tooltip" data-placement="top" title="If you need to hire people click here."><i class="fa fa-building"></i> Company register</span></div>
<div class="panel-body">
<p>
<img src="{{ asset('images/signup-icon.png') }}" class="img-responsive img-circle regimg" alt="Register" >
</p>
<form class="form-horizontal" role="form" method="POST" action="{{ route('company.register.submit') }}">
{{ csrf_field() }}
<div class="row">
<div class="col-md-6">
<div class="form-group{{ $errors->has('company_name') ? ' has-error' : '' }}">
<label for="company_name" class="col-md-4 control-label"><i class="fa fa-user-circle"></i> Company Name</label>
<div class="col-md-8">
<input id="company_name" type="text" class="form-control" name="company_name" value="{{ old('company_name') }}" required autofocus>
#if ($errors->has('company_name'))
<span class="help-block">
<strong>{{ $errors->first('company_name') }}</strong>
</span>
#endif
</div>
</div>
</div><!-- end col-md-6 -->
<div class="col-md-6">
<div class="form-group{{ $errors->has('manager_name') ? ' has-error' : '' }}">
<label for="manager_name" class="col-md-4 control-label"><i class="fa fa-user-circle-o"></i> Manager Name</label>
<div class="col-md-8">
<input id="manager_name" type="text" class="form-control" name="manager_name" value="{{ old('manager_name') }}" required autofocus>
#if ($errors->has('manager_name'))
<span class="help-block">
<strong>{{ $errors->first('manager_name') }}</strong>
</span>
#endif
</div>
</div>
</div><!-- end col-md-6 -->
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group{{ $errors->has('address') ? ' has-error' : '' }}">
<label for="address" class="col-md-4 control-label"><i class="fa fa-address-book"></i> Address</label>
<div class="col-md-8">
<input id="address" type="text" class="form-control" name="address" value="{{ old('address') }}" required autofocus>
#if ($errors->has('address'))
<span class="help-block">
<strong>{{ $errors->first('address') }}</strong>
</span>
#endif
</div>
</div>
</div><!-- end col-md-6 -->
<div class="col-md-6">
<div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
<label for="email" class="col-md-4 control-label"><i class="fa fa-envelope"></i> E-Mail Address</label>
<div class="col-md-8">
<input id="email" type="email" class="form-control" name="email" value="{{ old('email') }}" required>
#if ($errors->has('email'))
<span class="help-block">
<strong>{{ $errors->first('email') }}</strong>
</span>
#endif
</div>
</div>
</div><!-- end col-md-6 -->
</div>
<div class="form-group{{ $errors->has('username') ? ' has-error' : '' }}">
<label for="username" class="col-md-4 control-label"><i class="fa fa-birthday-cake"></i> username</label>
<div class="col-md-6">
<input id="username" type="text" class="form-control" name="username" value="{{ old('username') }}" autofocus>
#if ($errors->has('username'))
<span class="help-block">
<strong>{{ $errors->first('username') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group{{ $errors->has('about') ? ' has-error' : '' }}">
<label for="about" class="col-md-4 control-label"><i class="fa fa-birthday-cake"></i> about</label>
<div class="col-md-6">
<input id="about" type="textarea" class="form-control" name="about" value="{{ old('about') }}" autofocus>
#if ($errors->has('about'))
<span class="help-block">
<strong>{{ $errors->first('about') }}</strong>
</span>
#endif
</div>
</div>
<div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
<label for="password" class="col-md-4 control-label"><i class="fa fa-key"></i> 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">
<label for="password-confirm" class="col-md-4 control-label"><i class="fa fa-unlock-alt"></i> Confirm Password</label>
<div class="col-md-6">
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" required>
</div>
</div>
<div class="form-group">
<div class="col-md-6 col-md-offset-4">
<button type="submit" class="btn btn-success btn-bg btn-block">
<i class="fa fa-registered"></i> Register
</button>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
#endsection
Any idea why this doesn't work?