1

I am an obvious beginner of laravel and I am having a problem about this : Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException

I don't know on what seems to be the problem.. Whenever I hit the register button, That error would show up. What would be the probable cause for this error?

AdminController.php:

<?php

class AdminController extends Basecontroller{

    public function index()
    {   
        return View::make('content.index');
    } 

    public function registration()
    {
        return View::make('content.registration');
    }

    public function registrationSave()
    {
        $input= Input::all();
        $rules = array('username'=>'required|unique:admin', 'name'=>'required|unique:admin', 'password'=>'required');
        $validate = Validator::make($input,$rules);
        if($validate->passes())
        {
            $password = $input['password'];
            $password = Hash::make($password);

            $user= new User();
            $user->username=$input['username'];
            $user->name=$input['name'];
            $user->password=$password;
            $user->save();

            return Redirect::to('registration');

        }
    }

}

routes.php:

    Route::get('/','AdminController@index');

// Admin Registration
Route::get('admin/registration','AdminController@registration');
Route::post('admin/registration','AdminController@registrationSave');

registration.blade.php:

   @extends('layouts.master')
   @section('content')
     {{ Form::open(['url'=>'admin/registrationSave']) }}
          <div>
          {{ Form::label('name','Name: ') }} 
          {{ Form::text('name','',['placeholder'=>'Name']) }}          
          </div>
          <div>      
          {{ Form::label('username','Username: ') }} 
          {{ Form::text('username','',['placeholder'=>'Username']) }}
          </div>
          <div>
          {{ Form::label('password','Password: ') }} 
          {{ Form::password('password','',['placeholder'=>'Password']) }}          
          </div>

          <div>
          {{ Form::submit('Register') }}
          </div>
       {{ Form::close() }}
@endsection  

1 Answer 1

2
{{ Form::open(['url'=>'admin/registrationSave']) }}

It looks like you're trying to point the URL to the method name of the controller, rather than the URL of the route itself. The get/post routes share the same actual URL, so change that line to this:

{{ Form::open(['url'=>'/admin/registration']) }}
Sign up to request clarification or add additional context in comments.

2 Comments

Sir, one more thing. Another error occurs, QLSTATE[42S02]: Base table or view not found: 1146 Table.. What could have I possibly done wrong?
You either a) don't have a user table migration created, or b) you have one but you just haven't run it yet. See this documentation page for more info on migrations or feel free to ask another question!.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.