Trick: Inserting data into database without seeder

Laravel, Laravel 5, 2015-06-16 23:58:11 UTC

In some case I found around the web, "php artisan db:seed" command doesn't work. Many of them confused what happened. There are no complete explanation to correct the error.

So, I came into my solution inserting data without seeder.

Before you start, please make sure you have users table in your database. If you don't have, please take a look into these steps (step 1 - step 3).

Follow these step-by-step inserting data into database without seeder;

1. Open "app/Http/routes.php" file

2. Insert these lines;

    $name = Input::get('name');
    $mail = input::get('email');
    $password = Input::get('password');
    $check = DB::table('users')
                'name' => $name,
                'email' => $mail,
                'password' => Hash::make($password)

    if($check) {
        echo "success";
    else {
        echo "fail";

3. Type in your browser "http://your_app/insert_user?name=your_name&"

4. If you can see "success" message in your page, it works. Open up your phpMyAdmin, and you can see a data in users table.