i am trying to store in db a serialize array, but I'm not pretty sure how to do that. I need to store "$raport->id_operator = $request->id_operator," as an array in Data Base. The default value for id_operator in db is "a:0:{}". Here si my controller
$arr = array();
$raport = Raports::find($id);
$details = [
$serializedArr = serialize($arr),
$raport->status = $request->status,
$raport->approved = $request->approved,
$raport->modify_user_id = Auth::user()->id,
$raport->id_operator = $request->id_operator,
$raport->updated_at = date('Y-m-d H:i:s'),
];
array_push($arr,$details);
if($raport->save())
{
return redirect()->back()->with('success','Kërkesa u dërgua me sukses :)');
}
else
{
return redirect()->back()->with('error','Kërkesa nuk u dërgua :( ');
}
and this are the values i want to add every time i edit.
<div class="col-md-4">
<label>Jep Akses</label>
<select class="select" name="id_operator" >
<option value="">Zgjidh operator</option>
@foreach($users as $user)
<option value=""> </option>
@endforeach
</select>
via User45648