/**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $panelistUsers = [['name' => 'Rizvan Tariq', 'email' => '*****@*****.**', 'password' => bcrypt('pass'), 'enabled' => 1], ['name' => 'Hannah Deloy', 'email' => '*****@*****.**', 'password' => bcrypt('pass'), 'enabled' => 1], ['name' => 'Ronaldo Oroz', 'email' => '*****@*****.**', 'password' => bcrypt('pass'), 'enabled' => 1]];
     foreach ($panelistUsers as $panelist) {
         $panelistUser = User::create($panelist);
         $panelist = new Panelist();
         $panelist->customer_id = 3;
         $panelist->user_id = $panelistUser->id;
         $panelist->save();
     }
 }
 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules(\Illuminate\Http\Request $req)
 {
     $passwordRule = 'required|confirmed';
     if (\Route::currentRouteName() == "users.panelists.update" && (int) $req->input("password") == 0) {
         $passwordRule = "";
     }
     $email = "required|email|unique:users";
     if (\Route::currentRouteName() == "users.panelists.update") {
         $panelist = Panelist::findOrFail($this->route('panelists'));
         $email = "required|email|unique:users,email," . $panelist->user_id;
     }
     return ['name' => 'required', 'email' => $email, 'password' => $passwordRule];
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($userId, $panelistId)
 {
     $panelist = Panelist::find($panelistId);
     $panelist->user()->delete();
     $panelist->delete();
 }