Answer the question
In order to leave comments, you need to log in
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
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question