jeudi 1 décembre 2016

Controller class not found laravel 5.1

I am new to laravel and I tried to post the values from view to controller. But I am not able to get through as i get error saying FatalErrorException in routes.php line 26: Class 'registration' not found while submitting the form

Routes.php

Route::get('/', function () {
    return view('welcome');
});

Route::get('/register', function(){
return view('register');
});

Route::post('/register_action', function()
{
     $values = registration::store();
});

Controller

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use App\model\registration as register_model

class registration extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store()
    {
        echo 'hello';
        register_model::saveFormData();
    }
}

View

<html>
<head>
    <meta charset="UTF-8">
    <title>Registration</title>
</head>
<body>
    {!! Form::open(array('url' => 'register_action')) !!}
        <p>Name : {!! Form::text('name') !!}</p>
        <p>Email : {!! Form::text('email') !!}</p>
        <p>Password : {!! Form::password('password') !!}</p>
        <p>Confirm Password : {!! Form::password('cpassword') !!}</p>
        <p>{!! Form::submit('Submit') !!}</p>
    {!! Form::close() !!}
</body>
</html>

Please help me to solve the issue and to get the post values in controller. Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire