Пример #1
0
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create(Request $request)
 {
     $data = Tool::removeSpace($request->all());
     $validator = Validator::make($data, ["Nombre" => "required", "escenario" => "required"]);
     $toArray = $validator->errors()->toArray();
     if ($validator->fails()) {
         return response()->json(['success' => false, 'errors' => $toArray]);
     } else {
         if ($data['id']) {
             $group = Group::find($data['id']);
             $group->name = $data['Nombre'];
             $group->challenge_id = $data['Reto'];
             $group->stage_id = $data['escenario'];
             $group->active = $data['Estatus'];
             $group->save();
             return response()->json(['success' => true]);
         } else {
             $dataBuild = $this->buildGroup($data['Reto']);
             if ($dataBuild) {
                 return response()->json(['success' => false, 'errors' => [0 => 'Ya no se pueden crear mas grupos para reto']]);
             } else {
                 Group::create(['name' => $data['Nombre'], 'challenge_id' => $data['Reto'], 'stage_id' => $data['escenario']]);
                 return response()->json(['success' => true]);
             }
         }
     }
 }
Пример #2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Group::create(["designation" => "Buraca02", "localization" => "Buraca", "creation_date" => "37262"]);
     Group::create(["designation" => "Buraca04", "localization" => "Buraca", "creation_date" => "38333"]);
     Group::create(["designation" => "Buraca08", "localization" => "Buraca", "creation_date" => "39425"]);
     Group::create(["designation" => "Buraca12", "localization" => "Buraca", "creation_date" => "40965"]);
     Group::create(["designation" => "Cacem10", "localization" => "Cacem", "creation_date" => "40195"]);
     Group::create(["designation" => "Caparide07", "localization" => "Tires", "creation_date" => "39131"]);
     Group::create(["designation" => "Entroncamento13", "localization" => "Entroncamento", "creation_date" => "41294"]);
     Group::create(["designation" => "Laranjeiras09", "localization" => "Laranjeiras", "creation_date" => "39873"]);
     Group::create(["designation" => "Lavradio07", "localization" => "Lavradio", "creation_date" => "41315"]);
     Group::create(["designation" => "Loures10", "localization" => "Loures", "creation_date" => "40216"]);
     Group::create(["designation" => "Madrona05 e Tires05", "localization" => "Madorna", "creation_date" => "38389"]);
     Group::create(["designation" => "MtA10", "localization" => "MtA", "creation_date" => "40216"]);
     Group::create(["designation" => "RM07", "localization" => "RM", "creation_date" => "39425"]);
     Group::create(["designation" => "SDR03", "localization" => "SDR", "creation_date" => "37633"]);
     Group::create(["designation" => "SDR10", "localization" => "SDR", "creation_date" => "40153"]);
     Group::create(["designation" => "SJB08", "localization" => "SJB", "creation_date" => "39509"]);
     Group::create(["designation" => "SJB12", "localization" => "SJB", "creation_date" => "40965"]);
     Group::create(["designation" => "Tires05", "localization" => "Tires", "creation_date" => "38382"]);
     Group::create(["designation" => "VN08", "localization" => "VN", "creation_date" => "39138"]);
     Group::create(["designation" => "VN11", "localization" => "VN", "creation_date" => "40587"]);
     Group::create(["designation" => "Cacem08", "localization" => "Cacem", "creation_date" => "25569"]);
     Group::create(["designation" => "CAboboda14", "localization" => "Conceição da Aboboda", "creation_date" => "41672"]);
     Group::create(["designation" => "SJB14", "localization" => "SJB", "creation_date" => "41665"]);
     Group::create(["designation" => "VN14", "localization" => "VN", "creation_date" => "41679"]);
 }
 public function run()
 {
     $faker = Faker::create();
     foreach (range(0, 30) as $index) {
         Group::create(['name' => $faker->sentence(1), 'sport_id' => $faker->biasedNumberBetween(0, 10), 'description' => $faker->sentence(10)]);
     }
 }
Пример #4
0
 public function postCreate()
 {
     // get all input
     $all_input = \Request::all();
     error_log("CI " . json_encode($all_input));
     // create group
     $group = \App\Group::create($all_input);
     // photo file input
     $photo_posted = array_key_exists('photo', $all_input);
     $photo_path = 'images/icons/default_group.png';
     if ($photo_posted) {
         $photo_path = 'images/uploads/groups/' . \Input::file('photo')->getClientOriginalName();
         \Image::make(\Input::file('photo'))->fit(100)->save($photo_path);
     }
     $group->photo = $photo_path;
     // attach user to group so that we can set him as a chairman
     $user = \Auth::user();
     $user->groups()->attach($group->id);
     // set user as user chairman
     $group->chairman_id = $user->id;
     $group->meeting_weekday = (int) $all_input['meeting_weekday'];
     $group->update();
     error_log("CI " . json_encode($group));
     return redirect("/groups/{$group->id}/update");
 }
 public function store(Request $request)
 {
     $this->validate($request, ['name' => 'required', 'description' => 'required']);
     $group = $request->all();
     Group::create($group);
     return redirect('admin/dashboard/group');
 }
Пример #6
0
 public function store(Request $request)
 {
     $this->validate($request, ['name' => 'required|min:3', 'cropper_json' => 'required', 'inputBanner' => 'required|image']);
     $user = Auth::user();
     $file = $request->file('inputBanner');
     $data = $request->input('cropper_json');
     $data = json_decode(stripslashes($data));
     $imageName = $user->id . str_random(20) . '.' . $file->getClientOriginalExtension();
     $file->move(public_path() . '/img/files/' . $user->id . '/', $imageName);
     $src = public_path() . '/img/files/' . $user->id . '/' . $imageName;
     $real_name = $file->getClientOriginalName();
     $size = $file->getClientSize() / (1024 * 1024);
     //calculate the file size in MB
     $img = Image::make($src);
     $img->rotate($data->rotate);
     $img->crop(intval($data->width), intval($data->height), intval($data->x), intval($data->y));
     $img->resize(1036, null, function ($constraint) {
         $constraint->aspectRatio();
     });
     $img->save($src, 90);
     $user->usage->add(filesize(public_path() . '/img/files/' . $user->id . '/' . $imageName) / (1024 * 1024));
     // storage add
     $group = Group::create(['user_id' => $user->id, 'name' => $request->input('name'), 'banner' => $user->id . "/" . $imageName]);
     $user->groups()->attach($group->id);
     return redirect(route('profile.group.list'));
 }
Пример #7
0
 /**
  * Store a newly created resource in storage.
  * @return Response
  * @internal param Request $request
  */
 public function store()
 {
     $input = Request::all();
     $group = Group::create($input);
     $group->save();
     return redirect('grupper');
 }
Пример #8
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(StoreGroupRequest $request)
 {
     if (Gate::denies('create', Group::class)) {
         abort(403);
     }
     Group::create(['group_name' => $request->group_name, 'assigned_barangay' => $request->assigned_barangay]);
     return redirect('/group')->with('alert-success', 'The record has been saved!');
 }
Пример #9
0
 private function groupTable()
 {
     Group::truncate();
     $data = [['title' => 'Администратор', 'system' => true], ['title' => 'Пользователь', 'system' => false]];
     foreach ($data as $v) {
         Group::create($v);
     }
 }
Пример #10
0
 public function run()
 {
     $faker = Faker::create();
     $userIds = User::lists('id');
     foreach (range(1, 20) as $index) {
         Group::create(['user_id' => $faker->randomElement($userIds), 'username' => $faker->word . $index, 'name' => $faker->name, 'description' => $faker->paragraph(), 'email' => $faker->email . $index]);
     }
 }
 public function run()
 {
     $groups = [['name' => 'Technical'], ['name' => 'Choir'], ['name' => 'Ushering']];
     DB::table('groups')->delete();
     foreach ($groups as $group) {
         Group::create($group);
     }
 }
Пример #12
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     $faker = Faker\Factory::create();
     $tutors = Tutor::lists('id')->all();
     for ($i = 0; $i < 20; $i++) {
         $groups = Group::create(array('tutor_id' => $faker->unique()->randomElement($tutors), 'name' => $faker->unique()->word, 'description' => $faker->paragraph($nbSentences = 5)));
     }
 }
Пример #13
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     // $this->call('UserTableSeeder');
     Group::create(['id' => 'admin', 'name' => 'Admin']);
     Group::create(['id' => 'user', 'name' => 'User']);
     User::create(['username' => 'admin', 'name' => 'Sys Admin', 'password' => 'admin', 'email' => env('MAIL_DEFAULT_SYS_EMAIL')]);
     Model::reguard();
 }
Пример #14
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create('it_IT');
     $utenti = $this->getUsersIDS();
     for ($i = 1; $i <= 6; $i++) {
         $group_name = $faker->sentence();
         $group_slug = Str::slug($group_name);
         Group::create(['group_name' => $group_name, 'group_slug' => $group_slug, 'group_avatar' => "avatar" . mt_rand(1, 6) . ".jpg", 'group_owner' => mt_rand(1, count($utenti)), 'active' => 1, 'created_at' => $faker->dateTimeThisYear($max = 'now')]);
     }
 }
Пример #15
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('groups')->delete();
     Group::create(['group_id' => '1', 'name' => 'Mens Singles']);
     Group::create(['group_id' => '2', 'name' => 'Womens Singles']);
     Group::create(['group_id' => '3', 'name' => 'Mens Doubles']);
     Group::create(['group_id' => '4', 'name' => 'Womens Doubles']);
     Group::create(['group_id' => '5', 'name' => 'Mens Mixed Doubles']);
     Group::create(['group_id' => '6', 'name' => 'Womens Mixed Doubles']);
 }
Пример #16
0
 public function postCreate()
 {
     $title = 'Groups';
     $all_input = \Request::all();
     $group = \App\Group::create($all_input);
     $group->photo = 'images\\icons\\default_group.png';
     $group->update();
     error_log('Group ' . json_encode($group));
     //return $this->getEdit($group);
     return redirect("/admin/groups/{$group->id}/update");
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     $group = Group::findOrFail(1);
     $new_group = Group::create(['name' => $group->name]);
     foreach ($group->projects as $project) {
         $project->group_id = $new_group->id;
         $project->save();
     }
     $group->name = 'Templates';
     $group->save();
 }
 public function run()
 {
     ///create admin role
     $group = Group::create(['name' => 'admin']);
     //create admin user
     $user = User::create(['name' => 'admin', 'password' => Hash::make('password'), 'email' => '*****@*****.**']);
     //Create non admin user
     $user2 = User::create(['name' => 'user', 'password' => Hash::make('password'), 'email' => '*****@*****.**']);
     //assign admin role to first user
     $user->assignGroup(1);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $user = User::findOrFail(1);
     //despues quitar
     $schoolyear = Schoolyear::orderBy('id', 'DESC')->first();
     $request['school_id'] = $user->school_id;
     $request['schoolyear_id'] = $schoolyear->id;
     //$this->validate($request, ['name' => 'required']); // Uncomment and modify if you need to validate any input.
     Group::create($request->all());
     return redirect('group');
 }
Пример #20
0
 public function run()
 {
     // users
     DB::table('users')->delete();
     $user = \App\User::create(['first_name' => 'Claudio', 'last_name' => 'Neto', 'name' => 'Claudio Neto', 'photo' => 'images/icons/default_user.png', 'company_name' => 'eenvoudmedia', 'company_address' => 'van diemenstraat', 'company_zip' => '1013', 'company_city' => 'amsterdam', 'company_country' => 'Netherlands', 'company_website' => 'www.eenvoudmedia.nl', 'confirmed' => '1', 'birthdate' => '1978-08-04', 'email' => '*****@*****.**', 'password' => bcrypt('xxx')]);
     // groups
     DB::table('groups')->delete();
     $group = \App\Group::create(['name' => 'eenvoudmedia', 'description' => 'Test Group', 'photo' => 'images/icons/default_group.png', 'website' => 'www.eenvodmedia.nl', 'country' => 'netherlands', 'city' => 'amsterdam', 'language' => 'dutch', 'meeting_time' => '17:00', 'meeting_weekday' => 5, 'chairman_id' => $user->id]);
     // attach user to group 1
     $user->groups()->attach($group->id);
     // make user an admin
     $user->roles()->attach(1);
     // create a past group meeting
     DB::table('groupmeetings')->delete();
     $gm = \App\Groupmeeting::create(['group_id' => $group->id, 'meeting_date' => '2015-03-19 22:00']);
     // user attended meeting
     DB::table('groupmeetingattendees')->delete();
     \App\Groupmeetingattendees::create(['meeting_id' => $gm->id, 'user_id' => $user->id]);
 }
Пример #21
0
 public function run()
 {
     DB::table('users')->delete();
     DB::table('child_guardian')->delete();
     $jon = User::create(array("name" => "Jon Toshmatov", "first_name" => "Jon", "last_name" => "Toshmatov", "email" => "*****@*****.**", "password" => Hash::make("business"), "slug" => 'jon_slug', "student_id" => '*****@*****.**'));
     $arron = User::create(array("name" => "Arron Kallenberg", "first_name" => "Arron", "last_name" => "Kallenberg", "email" => "*****@*****.**", "password" => Hash::make("business"), "slug" => 'arron-kallenberg', "student_id" => '*****@*****.**'));
     // Create 5 Teachers
     for ($i = 1; $i < 5; $i++) {
         $teacher = User::create(array("name" => "teacher" . $i, "email" => "*****@*****.**" . $i, "password" => Hash::make("business"), "slug" => 'teacher_slug' . $i, "student_id" => 'teacher_id' . $i));
     }
     // Create 5 Guardians
     for ($i = 1; $i < 5; $i++) {
         $guardian = User::create(array("name" => "parent" . $i, "email" => "*****@*****.**" . $i, "password" => Hash::make("business"), "slug" => 'parent_slug' . $i, "student_id" => 'guardian_id' . $i));
     }
     // Create 5 Children
     for ($i = 1; $i < 5; $i++) {
         $child = User::create(array("name" => "child" . $i, "email" => "*****@*****.**" . $i, "password" => Hash::make("business"), "slug" => 'child_slug' . $i, "student_id" => 'child_id' . $i));
     }
     DB::table('roles')->truncate();
     $admin = Role::create(array("title" => "admin"));
     $principal = Role::create(array("title" => "principal"));
     $role_teacher = Role::create(array("title" => "teacher"));
     $role_student = Role::create(array("title" => "student"));
     $jon->role()->sync([$admin->id]);
     $arron->role()->sync([$admin->id]);
     DB::table('child_guardian')->insert(['guardian_id' => $guardian->id, 'child_id' => $child->id]);
     for ($i = 1; $i < 5; $i++) {
         $district = District::create(array("title" => "District " . $i, "description" => "District:" . $i . " Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy tex "));
     }
     for ($i = 1; $i < 5; $i++) {
         $organization = Organization::create(array("title" => "Organization " . $i, "description" => "School:" . $i . " Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy tex "));
     }
     DB::table('district_organization')->insert(['district_id' => $district->id, 'organization_id' => $organization->id]);
     for ($i = 1; $i < 5; $i++) {
         $class = Group::create(array("organization_id" => $organization->id, "title" => "Class " . $i, "description" => "Class:" . $i . " Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy tex "));
     }
     // Create pages
     for ($i = 1; $i < 5; $i++) {
         $page = \app\cmwn\Page::create(array("title" => "title" . $i, "description" => "description" . $i, "avatar" => "/img/avatar.png"));
     }
 }
Пример #22
0
 public function group($id)
 {
     $faker = Faker::create();
     $counTeam = count(Team::where('challenge_id', '=', $id)->get());
     if ($counTeam < 24) {
         $crea = 4;
     } else {
         if ($counTeam >= 24) {
             $crea = 8;
         }
     }
     $sta = Stage::where('challenge_id', '=', $id)->where('back', '=', 0)->get()->toArray();
     $y = 0;
     for ($i = 1; $i <= $crea; $i++) {
         if ($y == count($sta) - 1) {
             $y = 0;
         }
         Group::create(['name' => 'Grupo ' . $i, 'challenge_id' => $id, 'stage_id' => $sta[$y]['id']]);
         $y++;
     }
 }
Пример #23
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $faker = Faker\Factory::create();
     //empty table first
     //Group::truncate();
     Group::create(['name' => 'Super Administrators', 'description' => 'Super Administrators']);
     Group::create(['name' => 'Administrators', 'description' => 'Administrators']);
     Group::create(['name' => 'AD Users', 'description' => 'AD Users']);
     Group::create(['name' => 'IT', 'description' => 'Information Technology']);
     Group::create(['name' => 'Managers', 'description' => 'Managers']);
     Group::create(['name' => 'BIT', 'description' => 'Business Integration Team']);
     Group::create(['name' => 'GIS', 'description' => 'GIS Team']);
     Group::create(['name' => 'SD', 'description' => 'Service Desk Team']);
     Group::create(['name' => 'TI', 'description' => 'Technology Infrastructure Team']);
     Group::create(['name' => 'Outage Workers', 'description' => 'Users who work outages']);
     // Group::create(['name' => 'Org Viewers', 'description' => 'Widget Viewers']);
     // Group::create(['name' => 'Org Managers', 'description' => 'Widget Managers']);
     // foreach(range(1,10) as $i) {
     //   Group::create(['name' => $faker->company, 'description' => $faker->sentence(6)]);
     // }
 }
Пример #24
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     DB::table('groups')->delete();
     DB::table('users')->delete();
     DB::table('password_resets')->delete();
     DB::table('rules')->delete();
     DB::table('roles')->delete();
     DB::table('role_user')->delete();
     DB::table('permissions')->delete();
     DB::table('permission_user')->delete();
     DB::table('permission_role')->delete();
     $admin_role = Role::create(['name' => 'Admin', 'slug' => 'admin', 'description' => '']);
     $group_admin_role = Role::create(['name' => 'Group Admin', 'slug' => 'groupadmin', 'description' => '']);
     $torino = Group::create(['name' => 'Torino']);
     $milano = Group::create(['name' => 'Milano']);
     $u = User::create(['name' => 'Amministratore', 'surname' => 'Generale', 'username' => 'admin', 'email' => '*****@*****.**', 'password' => Hash::make('cippalippa'), 'group_id' => $torino->id]);
     $u->attachRole($admin_role);
     $u = User::create(['name' => 'Amministratore', 'surname' => 'Torino', 'username' => 'admin_to', 'email' => '*****@*****.**', 'password' => Hash::make('cippalippa'), 'group_id' => $torino->id]);
     $u->attachRole($group_admin_role);
     Model::reguard();
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('projects', function (Blueprint $table) {
         $table->increments('id');
         $table->string('name');
         $table->string('repository');
         $table->string('hash');
         $table->string('branch')->default('master');
         $table->text('private_key');
         $table->text('public_key');
         $table->unsignedInteger('group_id');
         $table->unsignedInteger('builds_to_keep')->default(10);
         $table->string('url')->nullable();
         $table->string('build_url')->nullable();
         $table->enum('status', [Project::FINISHED, Project::PENDING, Project::DEPLOYING, Project::FAILED, Project::NOT_DEPLOYED])->default(Project::NOT_DEPLOYED);
         $table->dateTime('last_run')->nullable()->default(null);
         $table->timestamps();
         $table->softDeletes();
         $table->foreign('group_id')->references('id')->on('groups');
     });
     // Had to move this from the previous migration due to group having an attribute for project count
     Group::create(['name' => 'Projects']);
 }
Пример #26
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     // create a group
     DB::table('groups')->delete();
     Group::create(['name' => 'Local User Group']);
     // create a few badges
     DB::table('badges')->delete();
     Badge::create(['name' => 'Meeting', 'path' => 'badges/meeting.png']);
     Badge::create(['name' => 'Talk', 'path' => 'badges/conference.png']);
     Badge::create(['name' => 'Conference', 'path' => 'badges/conference.png']);
     Badge::create(['name' => 'Three Meetings']);
     Badge::create(['name' => 'Repository Contribution']);
     Badge::create(['name' => 'User Group Blogger']);
     Badge::create(['name' => 'User Group Website Contribution']);
     // create a user
     DB::table('users')->delete();
     $leader = new User();
     $leader->email = '*****@*****.**';
     $leader->name = 'John Smith';
     $leader->is_admin = 1;
     $leader->password = Hash::make('secret');
     $leader->save();
     $member = new User();
     $member->email = '*****@*****.**';
     $leader->name = 'Robert Jones';
     $member->is_admin = 0;
     $member->password = Hash::make('secret');
     $member->save();
     DB::table('group_user')->delete();
     $leader->groups()->attach(1);
     $member->groups()->attach(1);
     DB::table('badge_user')->delete();
     $member->badges()->attach(1);
     $member->badges()->attach(5);
 }
Пример #27
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, ['group_name' => 'required|max:255', 'group_description' => 'required']);
     Group::create(['name' => $request->group_name, 'description' => $request->group_description, 'active' => isset($request->is_active) ? 1 : 0]);
     return redirect('/groups');
 }
Пример #28
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     DB::table('results')->delete();
     DB::table('group_indicator')->delete();
     DB::table('group_user')->delete();
     DB::table('indicator_organization')->delete();
     DB::table('indicator_report')->delete();
     DB::table('report_user')->delete();
     DB::table('users')->delete();
     DB::table('organizations')->delete();
     DB::table('roles')->delete();
     DB::table('indicators')->delete();
     DB::table('groups')->delete();
     DB::table('reports')->delete();
     $roles = array(['name' => 'admin', 'display_name' => 'Admin'], ['name' => 'manager', 'display_name' => 'Manager'], ['name' => 'employee', 'display_name' => 'Employee']);
     foreach ($roles as $role) {
         Role::create($role);
     }
     $faker = Faker::create('pl_PL');
     $indicators = array(['name' => 'Wydane skierowania', 'function_name' => 'wyd_skier_001', 'type' => 'value', 'default_coefficient' => 1, 'description' => 'Liczba skierowań wydanych przez pracownika w badanym okresie.'], ['name' => 'Obsłużone wizyty', 'function_name' => 'obsluz_wiz_001', 'type' => 'value', 'default_coefficient' => 1, 'description' => 'Liczba wizyt obsłużonych przez pracownika w badanym okresie.'], ['name' => 'Udzielone ind. porady zawodowe', 'function_name' => 'ind_por_zaw_001', 'type' => 'value', 'default_coefficient' => 1, 'description' => 'Liczba indywidualnych porad zawodowych udzielonych przez pracownika w badanym okresie.'], ['name' => 'Udzielone grupowe porady zawodowe', 'function_name' => 'grup_por_zaw_001', 'type' => 'value', 'default_coefficient' => 1, 'description' => 'Liczba grupowych porad zawodowych udzielonych przez pracownika w badanym okresie.'], ['name' => 'Udzielone indywidualne inf. zawodowe', 'function_name' => 'ind_inf_zaw_001', 'type' => 'value', 'default_coefficient' => 1, 'description' => 'Liczba indywidualnych informacji zawodowych udzielonych przez pracownika w badanym okresie.'], ['name' => 'Zorganizowane grupowe inf. zawodowe', 'function_name' => 'grup_inf_zaw_001', 'type' => 'value', 'default_coefficient' => 1, 'description' => 'Liczba grupowych informacji zawodowych zorganizowanych przez pracownika w badanym okresie.'], ['name' => 'Badania kwest. do profilowania', 'function_name' => 'bad_kwest_prof_001', 'type' => 'value', 'default_coefficient' => 1, 'description' => 'Liczba badań kwestionariuszem do profilowania przeprowadzonych przez pracownika w badanym okresie.'], ['name' => 'Sporządzone IPD', 'function_name' => 'sporz_ipd_001', 'type' => 'value', 'default_coefficient' => 1, 'description' => 'Liczba indywidualnych planów działania sporządzonych przez pracownika w badanym okresie.'], ['name' => 'Zarejestrowani kontrahenci', 'function_name' => 'zarej_kontr_001', 'type' => 'value', 'default_coefficient' => 1, 'description' => 'Liczba kontrahentów zarejestrowanych przez pracownika w badanym okresie.'], ['name' => 'Kontakty z kontrahentami', 'function_name' => 'kont_kontr_001', 'type' => 'value', 'default_coefficient' => 1, 'description' => 'Liczba kontaktów z kontrahentami zrealizowanych przez pracownika w badanym okresie.']);
     foreach ($indicators as $indicator) {
         Indicator::create($indicator);
     }
     $organizations = array(['code' => 'demo', 'name' => 'Powiatowy Urząd Pracy Demo', 'active' => true], ['code' => '24780', 'name' => 'Powiatowy Urząd Pracy w Zabrzu', 'active' => true]);
     foreach ($organizations as $organization) {
         $newOrganization = Organization::create($organization);
         foreach (Indicator::all() as $indicator) {
             $newOrganization->indicators()->attach($indicator->id, ['coefficient' => $faker->randomFloat(3, 0, 10)]);
         }
     }
     foreach (range(1, 50) as $index) {
         $organization = Organization::all()->random(1);
         $gender = $faker->randomElement(['male', 'female']);
         $lastName = $faker->lastName($gender);
         $user = User::create(['login' => $organization->code . '_' . $faker->numerify($lastName . '###'), 'name' => $faker->firstName($gender), 'surname' => $lastName, 'password' => Hash::make('secret'), 'active' => $faker->boolean(), 'organization_id' => $organization->id]);
         $role = Role::all()->random(1);
         $user->attachRole($role);
     }
     foreach (Organization::all() as $organization) {
         foreach (range(1, rand(5, 10)) as $index) {
             $group = Group::create(['organization_id' => $organization->id, 'name' => $faker->numerify('Grupa testowa ####')]);
             $users = $organization->users()->orderBy(DB::raw('random()'))->take(rand(5, 10))->get();
             foreach ($users as $user) {
                 $group->users()->attach($user->id);
             }
             $indicators = Indicator::all()->random(rand(3, 7));
             foreach ($indicators as $indicator) {
                 $group->indicators()->attach($indicator->id);
             }
         }
     }
     $managers = User::whereHas('roles', function ($role) {
         $role->where('name', 'manager');
     })->get();
     foreach ($managers as $manager) {
         foreach (range(1, rand(3, 6)) as $index) {
             $endDate = $faker->dateTimeThisDecade();
             $report = Report::create(['owner_id' => $manager->id, 'name' => $faker->numerify('Raport testowy ####'), 'start_date' => $faker->dateTimeThisDecade($endDate), 'end_date' => $endDate]);
             $indicators = Indicator::all()->random(rand(2, 5));
             foreach ($indicators as $indicator) {
                 $report->indicators()->attach($indicator->id, ['show_value' => $faker->boolean(), 'show_points' => $faker->boolean()]);
             }
             $users = $manager->organization->users()->orderBy(DB::raw('random()'))->take(rand(5, 10))->get();
             foreach ($users as $user) {
                 $report->users()->attach($user->id, ['view_self' => $faker->boolean(), 'view_all' => $faker->boolean()]);
             }
         }
     }
     Model::reguard();
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     Group::create(Input::all());
 }
Пример #30
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     User::create(["name" => "administrator", "email" => "*****@*****.**", "password" => Hash::make("Krongatan4"), "group_id" => "1"]);
     Group::create(["name" => "Administrators", "permissions" => '{"administrator":true}']);
     Group::create(["name" => "Users", "permissions" => '{"administrator":false}']);
 }