I am new to laravel 5 and making simple wep app for login and registering forum.but when I use
return View::make('users.new')->with('title', 'Make it snappy Q&A - Register');
i get this fatal error FatalErrorException in 44abda604f695ce08bdffef46fad63d0 line 28: syntax error, unexpected ')', expecting ',' or ';'giving me headache for long time and couldnot resolve. here is my User controller:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use View;
class User extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public $restful = true;
public function index()
{
return View::make('users.new')->with('title', 'Make it snappy Q&A - Register');
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
$validation = User::validate(Input::all());
if($validation->passes()){
User::create(array(
'username'=>Input::get('username'),
'password'=>Hash::make(Input::get('password'))
));
return Redirect::to_route('home')->with('message','Thanks for registering!');
} else{
return Redirect::to_route('register')->with_errors($validation)->with_input();
}
}
here is my new.blade`enter code here`
@extends('layout.default')
@section('content')
<h1>Register</h1>
@if($errors->has())
<p>The following error has occured:</p>
<ul id ="form-errors">
{{ $errors->first('username','<li>:message</li>') }}
{{ $errors->first('password','<li>:message</li>') }}
{{ $errors->first('password_confirmation','<li>:message</li>') }}
</ul>
@endif
{!! Form::open('register','POST') !!}
<P>
{{ Form::label('username','Username:') }}<br />
{{ Form::text('username',Input::old('username')) }}
</P>
<P>
{{ Form::label('password','Password:') }}<br />
{{ Form::password('password') }}
</P>
<P>
{{ Form::label('password_confirmation','Confirm password:') }}<br />
{{ Form::password('password_confirmation')) }}
</P>
<p>{{ Form::submit('Register') }}</p>
{!! Form::close() !!}
@endsection
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire