Ejemplo n.º 1
0
 public function addSkill($student_id, Requests\CreateSkillRequest $request)
 {
     $student = Student::find($student_id);
     if (!$student) {
         return Response::json(['message' => 'Could not find student'], 400);
     }
     $skill = $student->addSkill(Input::get('skill'));
     return Response::json(['skill' => $skill]);
 }
Ejemplo n.º 2
0
 public function testGetStudentsAtSchool()
 {
     $faker = \Faker\Factory::create();
     $boston = Student::create(['first_name' => 'BostonStudent', 'last_name' => 'BostonStudent', 'nickname' => 'BostonStudent', 'email' => $faker->email, 'primary_school' => 2]);
     $boston->addSchool(1);
     $boston->addSchool(2);
     $chicago = Student::create(['first_name' => 'ChicagoStudent', 'last_name' => 'ChicagoStudent', 'nickname' => 'ChicagoStudent', 'email' => $faker->email, 'primary_school' => 2]);
     $chicago->addSchool(2);
     $nyc = Student::create(['first_name' => 'NYCStudent', 'last_name' => 'NYCStudent', 'nickname' => 'NYCStudent', 'email' => $faker->email, 'primary_school' => 1]);
     $nyc->addSchool(3);
     $la = Student::create(['first_name' => 'LAStudent', 'last_name' => 'LAStudent', 'nickname' => 'LAStudent', 'email' => $faker->email, 'primary_school' => 1]);
     $la->addSchool(4);
     $dc = Student::create(['first_name' => 'DCStudent', 'last_name' => 'DCStudent', 'nickname' => 'DCStudent', 'email' => $faker->email, 'primary_school' => 1]);
     $dc->addSchool(5);
     $this->get('/api/schools/1/students')->see('BostonStudent')->dontSee('ChicagoStudent')->dontSee('NYCStudent')->dontSee('LAStudent')->dontSee('DCStudent')->see('"id":"' . $boston->id . '"');
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $student = Student::find(1);
     $student->addSchool(1);
     $student->addSchool(2);
     $student->addSchool(3);
     $student = Student::find(2);
     $student->addSchool(1);
     $student->addSchool(2);
     $student->addSchool(3);
     $student = Student::find(3);
     $student->addSchool(1);
     $student = Student::find(4);
     $student->addSchool(1);
     $student = Student::find(5);
     $student->addSchool(1);
     $student = Student::find(6);
     $student->addSchool(1);
     $student = Student::find(7);
     $student->addSchool(1);
     $student = Student::find(8);
     $student->addSchool(1);
     $student = Student::find(9);
     $student->addSchool(2);
     $student = Student::find(10);
     $student->addSchool(2);
     $student = Student::find(11);
     $student->addSchool(3);
     $student = Student::find(12);
     $student->addSchool(4);
     $student = Student::find(13);
     $student->addSchool(4);
     $student = Student::find(14);
     $student->addSchool(4);
     $student = Student::find(15);
     $student->addSchool(4);
 }
Ejemplo n.º 4
0
 public function testAddSchool()
 {
     $boston = Student::create(['first_name' => 'BostonStudent', 'last_name' => 'BostonStudent', 'nickname' => 'BostonStudent', 'email' => '*****@*****.**', 'primary_school' => 2]);
     $boston->addSchool(1);
     $this->seeInDatabase('school_student', ['student_id' => $boston->id, 'school_id' => 1]);
 }
Ejemplo n.º 5
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     \Tsny\Models\Student::truncate();
     factory(\Tsny\Models\Student::class, 20)->create();
 }