nagm_star
4 months ago
265
7
Laravel

How to delete image from folder after delete post

Posted 4 months ago by nagm_star

show this error "unlink(): http does not allow unlinking"

this is function


    public function kill(post $post , $id)
    {

        $post = Post::withTrashed()->where('id', $id)->firstOrFail();
        //dd($post);

        if($post->trashed()) {

            unlink($post->featured);
            $post->forceDelete();
        } else {

            $post->delete();
        }
        session()->flash('success', 'Post Deleted successfully');

        return redirect(route('posts.trashed'));


    }

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