Answer the question
In order to leave comments, you need to log in
Laravel: why can't I access the model?
The page has a form.
To record the entered data in the database, I need to find a specific row from the table:
This happens as follows:
$alerts_info = $request->get('alert_info');
foreach ($alerts_info as $id => $value) {
$alert = AlertsModel::find($id + 1);
dd($alert);
$alert->alert_info = $value;
$alert->save();
}
$visibility_vals = $request->get('block_visibility');
foreach ($visibility_vals as $id => $value) {
$visibility = VisibilityModel::find($id + 1);
if (is_null($value)) {
$value = 0;
};
//dd($visibility);
//$visibility->visible = $value;
//$visibility->save();
}
$visibility_vals = $request->get('block_visibility');
foreach ($visibility_vals as $id => $value) {
$visibility = VisibilityModel::All();
if (is_null($value)) {
$value = 0;
};
dd($visibility);
$visibility->visible = $value;
$visibility->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