jeudi 29 décembre 2016

How to pass array to flash message?

I want to send array of additional_feature that they are exist to flash message. Now i only send one additional_feature. Any suggestion how can i do that?

 if(!empty($additional_features)){
          foreach($additional_features as $additional_feature){
            $data = [
               'name' => $additional_feature,
             ];
             if (!Feature::where('name', '=', $additional_feature)->exists()) {
                 $additional = Feature::firstOrCreate($data);
                 $additional_ids[] = $additional->id;
             }
             else{
               return redirect()->back()->withFlashMessage($additional_feature . ' exists!');
             }

          }
        }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire