lundi 31 octobre 2016

why it is showing error in laravel? NotFoundHttpException in RouteCollection.php line 161:

can any body help me, I'm beginner to laravel, i got the below error.

Route.php

  Route::group(['middleware' => ['web']], function(){
  Route::get('/', function () {
  return view('welcome');
  });

  Route::post('/signup', [
  'uses' => 'UserController@postSignup',
  'as' => 'signup'
  ]);

  Route::post('/signin', [
  'uses' => 'UserController@postSignin',
  'as' => 'signin'
  ]);

  Route::get('/dashboard', [
    'uses' => 'UserController@getDashboard',
    'as' => 'dashboard'
  ]);
});

welcome.blade.php

 @extends('layouts.master')

 @section('title')
 Welcome
 @endsection

 @section('content')
 <div class="row">
    <div class="col-md-6">
    <h3>Sign Up</h3>
        <form method="post" action="">
            <div class="form-group">
                <label for="email">Enter your email</label>
                <input type="text" class="form-control" name="email" id="email">
            </div>
            <div class="form-group">
                <label for="user_name">User full name</label>
                <input type="text" class="form-control" name="user_name" id="user_name">
            </div>
            <div class="form-group">
                <label for="password">Password</label>
                <input type="password" class="form-control" name="password" id="password">
            </div>
            <button type="submit" class="btn btn-primary">Submit</button>
            <input type="hidden" name="_token" value="">
        </form>
    </div>
    <div class="col-md-6">
    <h3>Sign In</h3>
        <form method="post" action="">
            <div class="form-group">
                <label for="email">Enter your email</label>
                <input type="text" class="form-control" name="email" id="email">
            </div>
            <div class="form-group">
                <label for="password">Password</label>
                <input type="password" class="form-control" name="password" id="password">
            </div>
            <button type="submit" class="btn btn-primary">Submit</button>
            <input type="hidden" name="_token" value="">
        </form>
    </div>
    </div> 
   @endsection

UserController.php

  <?php

  namespace App\Http\Controllers;

  use App\user;
  use Illuminate\Http\Request;
  use Illuminate\Support\Facades\Auth;
  use App\Http\Requests;

  class UserController extends Controller
  {
   public function getDashboard()
  {
    return view('dashboard');
  }

 public function postSignup(Request $request)
 {
    $user_name = $request['user_name'];
    $email = $request['email'];
    $password = bcrypt($request['password']);

    $user = new User();
    $user->name = $user_name;
    $user->email = $email;
    $user->password = $password;

    $user->save();

    return redirect()->route('dashboard');
}

public function postSingin(Request $request)
{
    if(Auth::attempt(['email' => $request['email'], 'password' => $request['password']]))
    {
        return redirect()->route('dashboard');      
    }
    return redirect()->back();

  }
 }

dashboard.blade.php

    <h1>This is the dashboard page...</h1>

I'm not understand what is the problem, can any body explain breafly... Thanks a lot



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2f9xkQW
via IFTTT

Aucun commentaire:

Enregistrer un commentaire