public function clientHome()
 {
     $client = User::find(Auth::user()->id);
     $clientes = Preference::where('idUser', '=', Auth::user()->id)->get();
     $clientPreferences = [];
     foreach ($clientes as $cliente) {
         $preferencias = Event::where(['category_id' => $cliente->idCategories, "cancelled" => "0"])->get();
         // puede haber varios eventos del mismo tipo
         foreach ($preferencias as $preference) {
             array_push($clientPreferences, $preference);
         }
     }
     return view('internal.client.home', compact('clientPreferences', 'client'));
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(UpdateClientRequest $request)
 {
     $id = Auth::user()->id;
     $obj = User::findOrFail($id);
     $input = $request->all();
     $obj->name = $input['name'];
     $obj->lastname = $input['lastname'];
     $obj->address = $input['address'];
     $obj->phone = $input['phone'];
     $obj->email = $input['email'];
     $obj->di_type = $input['di_type'];
     $obj->di = $input['di'];
     $obj->save();
     Preference::where('idUser', '=', $obj->id)->delete();
     // rip tabla preferences
     $values = array_values($input);
     $i = 8;
     while (!empty($values[$i])) {
         $preference = new Preference();
         $preference->idUser = $obj->id;
         $preference->idCategories = $values[$i];
         $preference->save();
         $i = $i + 1;
     }
     Session::flash('message', 'InformaciĆ³n de perfil actualizada!');
     Session::flash('alert-class', 'alert-success');
     return redirect('client');
 }