Z
Z
Zhandoss2020-11-19 15:06:12
Laravel
Zhandoss, 2020-11-19 15:06:12

How to fix an error when adding an entry to the database?

Hello! Who faced a similar situation. When adding records to the database, I get an error.
SQLSTATE[42S02]: Base table or view not found: 1146
Table migrated and specified correctly.
Here is the model
class class EstablishmentOptions extends Model
{


protected $table_cuisines='cuisines';

}

Controller

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

public function addCuisine(Request $request)
{
$this->validate($request, [
'cuisine'=>['required', 'string',
]);

$cuisines = new EstablishmentOptions;
$cuisines->name=$request->cuisines;
$cuisines->save();


}
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Gleb Starkov, 2020-11-19
@Zhandoss

protected $table_cuisines='cuisines';

what's this?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question