I am getting this error whenever I try to delete and element in the array. It only work when I delete everything. But I want to delete one by one. this is delete function
public function delete($id){
$user_id = auth() ->user()->id;
$card = travel_plan::all()->where('travel_id', $user_id);
foreach($card as $cardId){
$cardd = $cardId;
} //->where('city_name', $uo)->first();
$cardd->delete();
return redirect('/home')->with('success', 'Post Removed');
}
this is my delete button
{!!Form::open(['action'=>['TravelPlanController@delete','id' =>$cardd[]],'method'=>'POST','class'=>''])!!}
this is how I retrieved the id
$cardd = array();
$card = travel_plan::all()->where('travel_id', $user_id);
foreach($card as $cardId){
$cardd [] = $cardId ->id;
}
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/36rDmXG
via IFTTT
Aucun commentaire:
Enregistrer un commentaire