laravel - unserialize error from a column in database -
since 1 day have exception view when want access unserialized column. it's strange because in pages it's working , others error
hope me .. don't know why work , not. tested base64_encode() , base64_decode() error views different records
unserialize error offet
here controller when create new order
$order = new order(); $order->cart = serialize($cart); ... $order->save();
now controller when unserialize
public function show($id) { $order = order::findorfail($id); $order->cart = unserialize($order->cart); $order->cart->totalprice; $prix_total = $order->cart->totalprice; $structure_id = $order->structure_id; $structure = structure::where('id' , '=' , $structure_id)->first(); $federation = structure::where('id' , '1')->first(); return view('cotisation_structure/show' , compact('prix_total', 'order' , 'structure' , 'federation')); }
now view display records in "cart" column :
@foreach($order->cart->items $item) <tr> @if(auth::user()->isfederation()) <td><input type="checkbox" name="checkbox[]" value="{{$item['item']->id}}"></td> @endif <td><a href="{!! route('licencie.show', $item['item']->id) !!}">{{$item['item']->num_licence}}</a></td> <th>{{$item['item']->lb_nom}}</th> <th>{{$item['item']->lb_prenom}}</th> <th>{{$item['item']->structure->nom_structure}}</th> <td> @if($item['item']->lb_tricolore != null) {{$item['item']->lb_activite_tricolore}} - {{$item['item']->lb_tricolore}} @else {{$item['item']->activite_licencie->lb_activite}} @endif </td> <th>{{$item['item']->saison->lb_saison}}</th> <th>{{$order->payment_method}}</th> <th>{{$item['price']}} € </th> <td>{{carbon\carbon::parse($order->date_achat)->format('d/m/y')}}</td> </tr> @endforeach
it possible storing serialized field in string
type of database table field , gets stripped @ 255 characters.
for further debugging recommend save serialized data log , when restoring also. in case can compare if data saved same taken out.
Comments
Post a Comment