/**
  * Store a newly created resource in storage.
  * POST /coach
  *
  * @return Response
  */
 public function store($id)
 {
     $user = Auth::user();
     $club = $user->Clubs()->FirstOrFail();
     $team = Team::Find($id);
     $coachUser = User::Find(Input::get('user'));
     $input = Input::all();
     $messages = array('user.required' => 'Please select a user', 'user.unique' => 'User selected is already a coach for this team');
     $validator = Validator::make(Input::all(), Coach::$rules, $messages);
     if ($validator->passes()) {
         $coach = new Coach();
         $coach->user_id = $coachUser->id;
         $coach->team_id = $team->id;
         $status = $coach->save();
         if ($status) {
             $newCoach = Coach::find($coach->id);
             return Redirect::action('TeamController@show', $team->id)->with('notice', 'Player added successfully');
         } else {
             $error = $status->errors()->all(':message');
             return Redirect::back()->withInput()->withErrors($error);
         }
     }
     $error = $validator->errors()->all(':message');
     return Redirect::back()->withInput()->withErrors($error);
 }
 protected function statsFromCoach($list, $id)
 {
     foreach ($list as $key => $entry) {
         switch ($entry) {
             case 'Head Coach':
             case 'Name:':
             case 'Alma Mater':
             case 'Date Of Birth':
             case 'Yrs Coaching':
             case 'Record':
                 unset($list[$key]);
                 break;
             default:
                 break;
         }
     }
     $temp = $list;
     unset($list);
     $list = array();
     foreach ($temp as $key => $value) {
         if ($value != '') {
             $list[] = $value;
         }
     }
     $name = $list[0];
     $slug = $this->CI->slugify->simple($name);
     $name = explode(' ', $name);
     $this->CI->load->model('coachRepository', '_coach');
     $coach = $this->CI->_coach->findOneByNcaaId($id);
     if (!$coach) {
         $coach = new Coach();
         $coach->setFirstName($name[0]);
         $coach->setLastName($name[1]);
         $coach->setSlug($slug);
         $coach->setNcaaId($id);
         $coach->save();
     }
     return $coach;
 }