Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

fbc's avatar
Level 2

SQLSTATE[HY000]: General error: 1 no such table: estimates

I can't quite understand why I'm getting this error: routes/web.php:

Route::resource('/estimate', 'EstimateController');
Route::get('/estimate/createrfc', 'EstimateController@createrfc')->name('estimate.createrfc');
Route::get('/estimate/createra', 'EstimateController@createra')->name('estimate.createra');

model Estimate.php:

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Estimate extends Model
{
    //
}

controller EstimateController.php:

<?php

namespace App\Http\Controllers;

use App\Estimate;
use Illuminate\Http\Request;

class EstimateController extends Controller
{
    public function __construct()
    {
        $this->middleware('auth');
    }

    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function index()
    {
        return view('estimate.index');
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function createrfc()
    {
        return view('welcome');

    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
     */
    public function createra()
    {
        return view('welcome');
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request)
    {
        //
    }

    /**
     * Display the specified resource.
     *
     * @param  \App\Estimate  $estimate
     * @return \Illuminate\Http\Response
     */
    public function show(Estimate $estimate)
    {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  \App\Estimate  $estimate
     * @return \Illuminate\Http\Response
     */
    public function edit(Estimate $estimate)
    {
        //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\Estimate  $estimate
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, Estimate $estimate)
    {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  \App\Estimate  $estimate
     * @return \Illuminate\Http\Response
     */
    public function destroy(Estimate $estimate)
    {
        //
    }
}

I can confirm the table does exist in the database.

I did have to change these lines for migrations to work with mariadb config/database.php:

        'mysql' => [
            'driver' => 'mysql',
            'url' => env('DATABASE_URL'),
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'unix_socket' => env('DB_SOCKET', ''),
//            'charset' => 'utf8mb4',
//            'collation' => 'utf8mb4_unicode_ci',
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix' => '',
            'prefix_indexes' => true,
            'strict' => true,
            'engine' => null,
            'options' => extension_loaded('pdo_mysql') ? array_filter([
                PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
            ]) : [],
        ],

php artisan migrate:status returns:

+------+------------------------------------------------+-------+
| Ran? | Migration                                      | Batch |
+------+------------------------------------------------+-------+
| Yes  | 2014_10_12_000000_create_users_table           | 1     |
| Yes  | 2014_10_12_100000_create_password_resets_table | 1     |
| Yes  | 2019_08_19_000000_create_failed_jobs_table     | 1     |
| Yes  | 2019_12_07_205745_create_products_table        | 1     |
| Yes  | 2019_12_15_210155_create_estimates_table       | 1     |
+------+------------------------------------------------+-------+
0 likes
10 replies
Nakov's avatar

@fbc and then you have a migration as well that creates the estimates table?

fbc's avatar
Level 2

yes.. I performed the migration.. no errors

Nakov's avatar

@fbc I mean the error says that there is no such table :)

Have you really checked your database?

Is the connection to the database setup correctly? You modified .env file to add your database name, username, password?

fbc's avatar
Level 2

yes.. it's the weirdest thing...

this is the first time using Laravel 6 and I did have an issue with migrations and mariaDB,, please see my updates on the first post.

Nakov's avatar

hm, that's strange. This is what I would do to make sure all good, in the terminal:

> mysql -uroot -p

when it connects:

> use database_name;

> show tables;
fbc's avatar
Level 2

disregard... I stopped php artisan serve and restarted it.. and the problem went away.. now I get a 404.

Nakov's avatar
Nakov
Best Answer
Level 73

@fbc ah, that's the cons on using artisan serve :) for each change you will have to restart it.

Please or to participate in this conversation.