jeigh
244
6
Laravel

Cannot post to database from form

Posted 3 years ago by jeigh

Previously I have been able to post to my database using a form down to the Users.php class. I am now trying to post to my database some answers which the user inputs.

I get the error Class 'Userq' not found and i am wondering how I can assign this class.

Here is my routes.php


/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/

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

Route::auth();

Route::get('/home', 'HomeController@index');


Route::post('home', function () {
    $userq = new Userq;
    $userq->Q1 = Input::Get('Q1');
    $userq->Q2 = Input::Get('Q2');
    $userq->Q3 = Input::Get('Q3');
    $userq->save();
    return redirect('level1');
});

Route::get('level1', function()
{
    return View::make('level1');
});

Any help would be greatly appreciated.

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.