mardi 29 octobre 2019

Can't "except" category in Posts controller

I have table with ID, Category_id, title etc... I need to output every category except nr. "10"

I allready outputted only category_id = 10, but dont know how to output others except category 10.

Here is controller:

public function index()
{   
    $sponsored = Raksti::where('category_id', '10')->get();
    $kat = RakstuKategorijas::all();
    $raksts = Raksti::all();
    $raksti = collect($raksts)->except('category_id', '10');

    return view('home',[
        'sponsored' => $sponsored,
        'kat' => $kat,
        'raksti' => $raksti,
    ]);
}
}

I don't get any errors - code output all posts including category 10



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2pbevrz
via IFTTT

Aucun commentaire:

Enregistrer un commentaire