简体   繁体   中英

laravel - 500 Internal Server Error - insert code error

I am a total newbie to laravel. I try to insert data into db and get - 'NetworkError: 500 Internal Server Error'.

This is my code -

class UserController extends BaseController {


    public function index() 
    {
        $user = new User;

        $user->username = 'tester';
        $user->password = md5('calpinet');
        $user->fullname = 'Tester';
        $user->email = 'tester@gmail.com';
        $user->status = 0;

        $user->save();
        return View::make('user.index');
    }
}

routes.php

Route::get('user/{id}', 'UserController@showProfile')->where('id', '[0-9]+');
Route::get('user/index', 'UserController@index');
Route::get('user/', 'UserController@index');

Can anyone help me , please...

Try running composer install after cloning the repo. The vendor directory is in the Laravel .gitignore file by default.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM