1 year ago

Why did not delete table records in Laravel 5?

Posted 1 year ago by Msoft

working with Laravel and has table called as vehicles and I need delete table records who are logged with the app and related to create records with logged user, I am showing logged user records with following

vehicle model

public function scopePersonal($query)
     return $query->where('user_id', Auth::user()->id);


and VehcicleController

public function indexpersonel()
         $vehicles = Vehicle::personal()->get();
        return view('vehicles.myads')->withVehicles($vehicles);

and my ads delete buttons link

<td><a class="button is-outlined" href="/myads/{{$vehicule->id}}/delete" onclick="return confirm('Are you sure to want to delete this record?')" >Delete</a></td>

and vehicle controller delete function

public function deleteOneAd($id)
            ->where('id', $id)

        return redirect()->back();

but when I clicked delete button and accept javascripts popup it is not deleting vehicles table records. how can I fix this problem?

Please sign in or create an account to participate in this conversation.