laravel delete multiple record from different database at once

I want delete two record from different table with one delete function. however it is only deleting one of the record even though I passed two different Ids. this is my delete function

 public function delete($id){
$user_id = auth() ->user()->id;
$card = Card::where('id', $id)->delete();
$actCity = city::where('id', $id)->delete();

return redirect('/home')->with('success', 'Post Removed');

this is my delete button

 @if (!empty($cardd && $actCity))
{!!Form::open(['action'=>['PlanController@delete','id' =>$cardd[0], 'id'=>$actCity[0]],'method'=>'POST','class'=>''])!!}
@endif

{!! Form::submit('Delete', array(
'class' => 'btn btn-danger',
'onclick' => "if( ! confirm('Are you sure you want to delete your
package?')){return false;}"
)) !!} {!! Form::close() !!}

my route

Route::delete('delete/{id}', 'PlanController@delete');


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2uInoLk
via IFTTT

تعليقات

المشاركات الشائعة من هذه المدونة

I am unable to figure out how to create payment collection request, after a form has been submitted in laravel

laravel, mysql transaction not working after failed one time