mercredi 30 novembre 2016

Call to a member function where() on array laravel 5.0.35

I`m use

    public function getImages($array_symbols_id){

    $array_images  = DB::table('photo')
        ->whereIn('photo_symbol_id', $array_symbols_id)
        ->where('photo_moderation_id','2')
        ->orderByRaw('RAND()')
        ->get(['photo_id', 'photo_src', 'photo_symbol_id']);

then try

        $array = array();

    foreach ($array_symbols_id as $id) {
        $array[] = $array_images->where('photo_symbol_id', $id)->first()->photo_src;
    }

but i have exception Call to a member function where() on array.

Why DB::table returns an array but not a collection?

laravel v5.0.35



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire