/**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 30) as $index) {
         Attendee::create(['first_name' => $faker->firstNameMale(), 'last_name' => $faker->lastName(), 'suffix' => $index % 5 ? NULL : $faker->suffix(), 'identifier' => $faker->regexify('[A-Z]?[0-9]{3}/[0-9]{3}')]);
     }
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Attendee::create(['event_id' => 1, 'school_id' => 1, 'role_id' => 1, 'last_name' => 'Testerman', 'first_name' => 'Test', 'gender' => 'M', 'grade' => 0, 'special_diet' => 'Test diet', 'bringing_meds' => 1, 'special_needs' => 'Testing needs', 'advisor_id' => 1]);
     Attendee::create(['event_id' => 1, 'school_id' => 1, 'role_id' => 2, 'last_name' => 'Testerman 2', 'first_name' => 'Test 2', 'gender' => 'F', 'grade' => 9, 'special_diet' => 'Test diet 2', 'bringing_meds' => 0, 'special_needs' => 'Testing needs 2', 'advisor_id' => 1]);
     Attendee::create(['event_id' => 1, 'school_id' => 1, 'role_id' => 1, 'last_name' => 'Testerman', 'first_name' => 'Test', 'gender' => 'M', 'grade' => 0, 'special_diet' => 'Test diet', 'bringing_meds' => 1, 'special_needs' => 'Testing needs', 'advisor_id' => 2]);
     Attendee::create(['event_id' => 1, 'school_id' => 1, 'role_id' => 1, 'last_name' => 'Testerman', 'first_name' => 'Test', 'gender' => 'M', 'grade' => 0, 'special_diet' => 'Test diet', 'bringing_meds' => 1, 'special_needs' => 'Testing needs', 'advisor_id' => 2]);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return \Illuminate\Http\Response
  */
 public function store()
 {
     if (!Input::get('first_name') or !Input::get('last_name') or !Input::get('identifier')) {
         return $this->respondUnprocessableEntity('Parameters failed validation for an attendee.');
     }
     Attendee::create(Input::all());
     return $this->respondCreated('Attendee successfully created.');
 }
 public function store(AttendeeRequest $request)
 {
     $input = $request->all();
     $attendee = Attendee::create(['first_name' => $input['first_name'], 'last_name' => $input['last_name'], 'address' => $input['address'], 'city' => $input['city'], 'country' => $input['country'], 'phone_number' => $input['phone_number'], 'email' => $input['email']]);
     if ($request->ajax() || $request->wantsJson()) {
         return new JsonResponse($attendee);
     }
     flash()->success('salvato con successo!');
     return redirect('attendees');
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(AttendeeRequest $request)
 {
     $attendee = Attendee::create($request->all());
     /*
              avevo scritto a mano il codice seguente prendendolo da user,
              ma è meglio usare la riga sopra, è più essenziale e pulita ed evita errori
              
               $input = $request->all();
     		  $attendee = Attendee::create([
                 'first_name' => $input['first_name'],
                 'surname' => $input['surname'],
                 'email' => $input ['email'],
     			'phone_number'=> ['phone_number'],
     			'address'=> $input ['address'],
     		    'country'=>$input ['country'],
             ]);*/
     if ($request->ajax() || $request->wantsJson()) {
         return new JsonResponse($attendee);
     }
     flash()->success('salvato con successo!');
     return redirect('attendees');
 }
Exemplo n.º 6
0
 public function store(AttendeeRequest $request)
 {
     Attendee::create($request->all());
     return redirect('events')->with('flash_message', trans('response.created'));
 }