Your db will prevent you from deleting records which have foreign relations. I believe the truncate method deletes them as well? But it’s only a guess without actually seeing how you structured your db..
Did you check the output of the call to $project->delete()
?
@alen i can delegte just the image here is it
{
if(\Auth::user()->can('delete project'))
{
if(!empty($project->image))
{
Utility::checkFileExistsnDelete([$project->project_image]);
}
$project->delete();
return redirect()->back()->with('success', __('Project Successfully Deleted.'));
}
else
{
return redirect()->back()->with('error', __('Permission Denied.'));
}
}
This will be your code
{ if(\Auth::user()->can('delete project')) { if(!empty($project->image)) { Utility::checkFileExistsnDelete([$project->project_image]);
$project->delete();
return redirect()->back()->with('success', __('Project Successfully Deleted.'));
}
else
{
return redirect()->back()->with('error', __('Permission Denied.'));
}
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community