php - How to insert data into MongoDB with Laravel -


first i've set default setting database connection mongodb.

'mongodb' => [       'driver'   => 'mongodb',       'host'     => 'localhost',       'username' => 'dofuser',       'password' => 'dofpass',       'database' => 'dof',   ], 

apps/models/user

   <?php use jenssegers\mongodb\model eloquent;  class user extends eloquent {      protected $collection = 'user';     //$user = user::all(); } 

and router

        route::post('/register', function() {    $user->model('user', 'app\models\user');    $user = new user;   $user = user::create(array( 'username' => input::get('username'), 'fullname' => input::get('fullname'), 'password' => hash::make(input::get('password')), 'gender' => input::get('gender'), 'month' => input::get('month'), 'day' => input::get('day'), 'year' => input::get('year'), 'phone' => input::get('phone'), 'email' => input::get('email-act'), 'agree' => input::get('agree') ));      return redirect('/login');  }); 

but submit browser blank. not redirect login in mongodb make collection named user.

you can check tutorial in youtube https://www.youtube.com/watch?v=ltfseuccd_4

it teach how add data laravel mongodb


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -