Support the ongoing development of Laravel.io →
Database Blade Laravel
0

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()?

Last updated 1 year ago.
0

@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.'));
        }
    }
0

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.'));
    }
}
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.