Is your feature request related to a problem? Please describe.
Backpack to fill the model uses $this->crud->getStrippedSaveRequest() and it function returns only the fillable attributes return $this->getRequest()->only($this->getAllFieldNames());
so, in this instance if I want to use something like this
it doesn't work because Backpack is cleaning the request bag.
Describe the solution you'd like
im not sure what's the better solution for this package, I only made a temporary fix for it.
Describe alternatives you've considered
a temporary solution is extending the updateOperation use \Backpack\CRUD\app\Http\Controllers\Operations\UpdateOperation{ update as traitUpdate; } and customizing it to save all request fields.
first is necessary to change $translatedAttributes from protected to public and modifying the request bag
public function update()
{
$this->crud->hasAccessOrFail('update');
$data = $this->crud->getRequest();
$translatables_attributes = $this->crud->model->translatedAttributes;
if($translatables_attributes) {
$translatables = [];
foreach ($translatables_attributes as $attribute) {
if ($data->get($attribute)) {
$translatables[app()->getLocale()][$attribute] = $data->get($attribute);
$data->request->remove($attribute);
}
}
$data->request->add($translatables);
}
// execute the FormRequest authorization and validation, if one is required
$request = $this->crud->validateRequest();
// update the row in the db
$item = $this->crud->update($request->get($this->crud->model->getKeyName()),
$data->all());
$item->save();
$this->data['entry'] = $this->crud->entry = $item;
// show a success message
\Alert::success(trans('backpack::crud.update_success'))->flash();
// save the redirect choice for next time
$this->crud->setSaveAction();
return $this->crud->performSaveAction($item->getKey());
}
in this way the update will works
and another thing I dont know why this way it doesnt work as new translation
Is your feature request related to a problem? Please describe. Backpack to fill the model uses
$this->crud->getStrippedSaveRequest()
and it function returns only the fillable attributesreturn $this->getRequest()->only($this->getAllFieldNames());
so, in this instance if I want to use something like this
it doesn't work because Backpack is cleaning the request bag.
Describe the solution you'd like im not sure what's the better solution for this package, I only made a temporary fix for it.
Describe alternatives you've considered a temporary solution is extending the updateOperation
use \Backpack\CRUD\app\Http\Controllers\Operations\UpdateOperation{ update as traitUpdate; }
and customizing it to save all request fields.first is necessary to change
$translatedAttributes
from protected to public and modifying the request bagin this way the update will works
and another thing I dont know why this way it doesnt work as new translation