Level 23
One easy way is to use the storage facade. And i would do it before deleting the post.
use Illuminate\Support\Facades\Storage;
Storage::delete($post->featured);
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 or to participate in this conversation.