コード例 #1
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Requests\Positions\UpdatePositionRequest $request, $id)
 {
     //
     $position = JobPosition::find($id);
     $position->name = $request->input('name');
     $position->save();
     return redirect()->intended('/positions');
 }
コード例 #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     $faker = Faker\Factory::create('en_GB');
     for ($i = 0; $i < 10; $i++) {
         // Ensure the same job position isn't added twice, as this would throw an error since
         // the job position name field is now unique.
         do {
             $name = $faker->jobTitle;
         } while (\App\Models\JobPosition::where('name', '=', $name)->count() > 0);
         // Add the job position
         \App\Models\JobPosition::create(['name' => $name]);
     }
 }
コード例 #3
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create('en_GB');
     $user = \App\Models\User::create(['email' => '*****@*****.**', 'personal_email' => $faker->safeEmail, 'password' => \Illuminate\Support\Facades\Hash::make('password'), 'first_name' => $faker->firstNameFemale, 'last_name' => $faker->lastName, 'dob' => $faker->dateTimeBetween('-30 years', 'now'), 'gender' => 'f', 'address1' => $faker->streetAddress, 'city' => $faker->city, 'state' => 'Any State', 'zip' => $faker->postcode, 'country' => 'United Kingdom', 'personal_telephone' => $faker->mobileNumber, 'work_telephone' => $faker->phoneNumber]);
     if ($user) {
         // Generate and save image
         $path = 'people/' . $user->id . '/face.jpg';
         \Illuminate\Support\Facades\Storage::put($path, file_get_contents('http://api.adorable.io/avatar/400/' . md5($user->id . $user->email) . ''));
         $user->image_path = $path;
         $user->save();
         $user->roles()->attach(\App\Models\Role::where('name', '=', 'admin')->first(), ['primary' => true]);
         $user->jobPositions()->attach(\App\Models\JobPosition::where('name', '=', 'Boss')->first(), ['primary' => true]);
     }
     $this->command->info('Administration user created. Username: administrator@progress.local, password: password.');
 }
コード例 #4
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     $faker = Faker\Factory::create('en_GB');
     for ($i = 0; $i < 25; $i++) {
         if (rand(0, 100) > 49) {
             // Male
             $user = \App\Models\User::create(['email' => $faker->safeEmail, 'personal_email' => $faker->safeEmail, 'password' => \Illuminate\Support\Facades\Hash::make('password'), 'first_name' => $faker->firstNameMale, 'last_name' => $faker->lastName, 'dob' => $faker->dateTimeBetween('-30 years', 'now'), 'gender' => 'm', 'address1' => $faker->streetAddress, 'city' => $faker->city, 'state' => 'Any State', 'zip' => $faker->postcode, 'country' => 'United Kingdom', 'personal_telephone' => $faker->mobileNumber, 'work_telephone' => $faker->phoneNumber]);
         } else {
             // Female
             $user = \App\Models\User::create(['email' => $faker->safeEmail, 'personal_email' => $faker->safeEmail, 'password' => \Illuminate\Support\Facades\Hash::make('password'), 'first_name' => $faker->firstNameFemale, 'last_name' => $faker->lastName, 'dob' => $faker->dateTimeBetween('-30 years', 'now'), 'gender' => 'f', 'address1' => $faker->streetAddress, 'city' => $faker->city, 'state' => 'Any State', 'zip' => $faker->postcode, 'country' => 'United Kingdom', 'personal_telephone' => $faker->mobileNumber, 'work_telephone' => $faker->phoneNumber]);
         }
         if ($user) {
             // Generate and save image
             $path = 'people/' . $user->id . '/face.jpg';
             \Illuminate\Support\Facades\Storage::put($path, file_get_contents('http://lorempixel.com/400/400/people/'));
             $user->image_path = $path;
             $user->save();
             $user->roles()->attach(\App\Models\Role::where('name', '=', 'user')->first());
             $user->jobPositions()->attach(\App\Models\JobPosition::orderBy(\DB::raw('RAND()'))->first());
         }
     }
 }
コード例 #5
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     \App\Models\JobPosition::create(['name' => 'Employee']);
     \App\Models\JobPosition::create(['name' => 'Boss']);
 }