Search code examples
phplaravellaravel-5php-7

How delete array of items?


I have destroy function:

public function destroy(Tag $tag)
{
    $tag->delete();
    return Response::json([], ResponseHttp::HTTP_OK);
}

If frontend send one id of post - all ok. But how delete if frontend send array of post?


Solution

  • I do it from filter -

    public function destroy()
        {
            Tag::filter(\Request::only(['filter']))->delete();
    
            return Response::json([], ResponseHttp::HTTP_OK);
        }