public function run()
 {
     DB::table('employees')->delete();
     $dirname = dirname(__FILE__);
     require 'employeeSeed.php';
     foreach ($employees as $employeeName => $employeeInfo) {
         if (Person::where('full_name', '=', $employeeName)->first()) {
             continue;
         }
         $person = new Person(['full_name' => $employeeName, 'honorific_prefix' => $employeeInfo['name'][0], 'given_name' => $employeeInfo['name'][1], 'additional_names' => $employeeInfo['name'][2], 'family_name' => $employeeInfo['name'][3], 'honorific_suffix' => $employeeInfo['name'][4], 'title' => $employeeInfo['title'], 'email' => $employeeInfo['email'], 'tel' => $employeeInfo['phone']]);
         $person->save();
         $employeeImage = null;
         if (!empty($employeeInfo['picture'])) {
             copy($dirname . "/default_images/reps/" . $employeeInfo['picture'], $dirname . "/" . $employeeInfo['picture']);
             $fileSize = filesize($dirname . "/" . $employeeInfo['picture']);
             $file = new UploadedFile($dirname . "/" . $employeeInfo['picture'], $employeeInfo['picture'], strpos($employeeInfo['picture'], '.jpg') === false ? "image/png" : "image/jpeg", $fileSize, null, true);
             $employeeImage = ImageList::upload($file);
         }
         $employee = new Employee();
         $employee->is($person);
         // Implies save
         $employee->service_area = $employeeInfo['service_area'];
         $employee->save();
         // Just in case
         if ($employeeImage != null) {
             $employee->picture()->save($employeeImage);
         }
         foreach ($employeeInfo['locations'] as $locationName) {
             $employee->locations()->attach(Location::where('name', '=', $locationName)->first());
         }
         $employee->save();
         // Last save shouldn't be necessary? Just in case, though...
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     //
     $person = Person::create(Request::all());
     $employee = new Employee();
     $employee->is($person);
     $employee->locations()->attach(Location::current());
     return ['id' => $employee->id, 'full_name' => $person->full_name, 'title' => $person->title, 'email' => $person->email, 'tel' => $person->tel];
 }