php - How can allow the method in routes using laravel 5? -


i'm trying execute method not working. know basic , may ask more time, didn't resolve.

controller

<?php   namespace app\http\controllers;  use illuminate\http\request; use app\http\requests; use app\http\controllers\controller;  class lockcontroller extends controller {      /**      * show profile given user.      *      * @param  int  $id      * @return response      */     public function index()     {          return view('lock');     }      public function login()     {           return view('login');     }  } ?> 

route

route::get('/lock', 'lockcontroller@index'); route::get('/lock', 'lockcontroller@login'); 

this route::get('/lock', 'lockcontroller@index'); route working fine using http://localhost/laraveldev/public/index.php/lock url route not working , i'm getting error notfoundhttpexception in routecollection.php line 161:. login method i'm using url http://localhost/laraveldev/public/index.php/lock/login.

i searched it, follow instruction of accepted answer not work, can 1 guide me i'm wrong.


you can mention required methods handled in controller file(s) in routes.php file.

example:
route::get('url/of/the/resource', 'controllername@action'); (o handle 'get' requests).
route::post('url/of/the/resource', 'controllername@action'); (for 'post' requests).

details:
route::get('/user/register', 'usercontroller@showregistrationform');
indicates show registration when given url (when request made) given below:.
http://localhost/your_laravel_project_folder/user/register

route::post('/user/register', 'usercontroller@handleuserregistration');
indicates handle registration data when user submits registration form. (when post request made).

class usercontroller extends controller
{
     public function showregistrationform()
       {
          return view('user.register');
         }
     public function handleuserregistration()
       {
          $registerinput = input::all();
          var_dump($registerinput);
         }
}


Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

Swift game error message -