@fbc and then you have a migration as well that creates the estimates table?
Dec 16, 2019
10
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 |
+------+------------------------------------------------+-------+
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.