コード例 #1
0
 /**
  * Run the users seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('organizations')->delete();
     $statement = "ALTER TABLE organizations AUTO_INCREMENT = 1;";
     DB::unprepared($statement);
     Organization::create(['uuid' => uniqid(), 'name' => 'Gorilla LTD', 'address' => '61 cours du médoc', 'address_comp' => 'appt 22 bat B', 'user_id' => 1]);
 }
コード例 #2
0
 /**
  * Store a newly created carpooling in storage.
  *
  * @param OrganizationRequest $request
  * @return Response
  */
 public function store(OrganizationRequest $request)
 {
     if (starts_with($request->get('name'), ['www']) || in_array($request->get('name'), ['cms', 'irispass', 'mail', 'desktop', 'bureau', 'chat', 'www', 'office', 'iris', 'only', 'admin'])) {
         Flash::error(Lang::get('organization.fail-name'));
         return redirect(action('OrganizationController@index'));
     }
     $this->organization = Organization::create($request->all());
     $this->organization->owner()->associate(Auth::user());
     $this->organization->save();
     Flash::success(Lang::get('organization.create-success'));
     return redirect(action('OrganizationController@index'));
 }
コード例 #3
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('organizations')->truncate();
     $faker = Faker::create();
     Organization::create(['name' => 'GLOBALFOUNDRIES']);
     /*
     foreach(range(1,30) as $index) {
         Organization::create([
             'name' => $faker->company,
         ]);
     }
     */
 }
コード例 #4
0
ファイル: SupplierRepo.php プロジェクト: jiannius/lar5-invie
 /**
  * Save 
  */
 public function save($supplier = null, $data = null)
 {
     DB::transaction(function () use(&$data, &$supplier) {
         if (is_null($supplier)) {
             $org = Organization::create($data['info']);
             $supplier = $org->supplier()->create($data);
         } else {
             $supplier->info->fill($data['info'])->save();
             $supplier->fill($data)->save();
         }
     });
     return $this->getById($supplier->id);
 }
コード例 #5
0
 public function create(Request $request)
 {
     $organization = Organization::create(['name' => $request->input('name')]);
     if ($organization->isValid()) {
         //create a role for current user
         $role = new Role();
         $role->user_id = $request->user()->id;
         $role->organization_id = $organization->id;
         $role->role = 'admin';
         $role->save();
         return redirect()->route('organizationUsers', [$organization->id]);
     }
     return redirect()->route('newOrganizationForm')->withInput()->withErrors($organization->getErrors());
 }
コード例 #6
0
ファイル: DBSeeder.php プロジェクト: searsaw/lunch
 public function run()
 {
     Artisan::call('migrate:refresh');
     $user = \App\User::create(['email' => '*****@*****.**', 'password' => '$2y$10$zhRDGljo5k5jn6oifVCA7.4GzB6OKmV1QkJfvErtcheR0m5jMLK9S', 'firstName' => 'ftesting1', 'lastName' => 'ltesting1']);
     $restaurant = \App\Restaurant::create(['name' => 'Burger King']);
     $organization = \App\Organization::create(['name' => 'Testing1']);
     $poll = \App\Poll::create(['closed_at' => '2017-05-18 03:00:00', 'closed_by' => '2017-05-18 04:00:00', 'organization_id' => 1]);
     $organization->restaurants()->save($restaurant);
     $poll->restaurants()->save($restaurant);
     $role = \App\Role::create(['user_id' => 1, 'organization_id' => 1, 'role' => 'Tester']);
     $organization_order = \App\OrganizationOrder::create(['organization_restaurant_id' => 1, 'due_by' => '2017-05-18 04:00:00', 'closed_at' => '2017-05-18 03:00:00']);
     $user_order = \App\UserOrder::create(['user_id' => 1, 'restaurant_id' => 1, 'default' => 1, 'order' => 'Test Burger']);
     $polloption = \App\PollRestaurant::find(1);
     $polloption->users()->save($user);
 }
コード例 #7
0
 public function store(CreateOrganizationRequest $request)
 {
     if (Gate::denies('adminOnly')) {
         abort(403);
     }
     $input = $request->all();
     $result = DB::transaction(function ($input) use($input) {
         $organization = Organization::create($input);
         // create automatically all indicators for the new organization
         foreach (Indicator::all() as $indicator) {
             $organization->indicators()->save($indicator, ['coefficient' => $indicator->default_coefficient]);
         }
         return $organization;
     });
     return $result;
 }
コード例 #8
0
ファイル: UserTableSeeder.php プロジェクト: jtoshmat/laravel
 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"));
     }
 }
コード例 #9
0
 /**
  * save organization to our DB - loop
  *
  * @param $data
  * @return $this
  */
 private function saveOrganization($data)
 {
     //built in validation, custom messages include org_name in the message
     $validator = Validator::make($data, ['org_name' => 'required|unique:organizations|max:255'], ['org_name.unique' => 'org_name :value is taken', 'org_name.max' => 'org_name :value too long']);
     if ($validator->fails()) {
         return $validator->errors();
     }
     //saving to DB
     $organization = Organization::create($data);
     if (isset($data['daughters']) && count($data['daughters']) > 0) {
         foreach ($data['daughters'] as $daughter) {
             $dresult = $this->saveOrganization($daughter);
             if (is_a($dresult, 'App\\Organization')) {
                 $organization->daughters()->save($dresult);
             } else {
                 return $dresult;
             }
         }
     }
     return $organization->load('daughters');
 }
コード例 #10
0
ファイル: ClientRepo.php プロジェクト: jiannius/lar5-invie
 /**
  * Save 
  */
 public function save($client = null, $data = null)
 {
     DB::transaction(function () use(&$data, &$client) {
         $type = $data['type'];
         // new client
         if (is_null($client)) {
             if ($type == 'organization') {
                 $entity = Organization::create($data['info']);
             } elseif ($type == 'person') {
                 $entity = Person::create($data['info']);
             }
             $client = $entity->client()->create($data);
         } else {
             if ($type == 'organization') {
                 $client->organization->fill($data['info'])->save();
             } elseif ($type == 'person') {
                 $client->person->fill($data['info'])->save();
             }
             $client->fill($data)->save();
         }
     });
     return $this->getById($client->id);
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Organization::create(['organization_name' => 'Organization One', 'slug' => 'organization']);
 }
コード例 #12
0
ファイル: ApiController.php プロジェクト: gfdeveloper/LCCB
 public function saveOrg(Request $request)
 {
     $this->validate($request, ['name' => 'required|unique:organizations']);
     Organization::create($request->all());
     return "GTG";
 }
コード例 #13
0
ファイル: DemoSeeder.php プロジェクト: ppawlas/swop
 /**
  * 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();
 }
コード例 #14
0
 public function store()
 {
     $store = Request::all();
     Organization::create($store);
     return redirect('organizations');
 }
コード例 #15
0
 public function createOrganization(CreateOrganizationRequest $request)
 {
     Organization::create(['name' => $request->input('org_name'), 'active' => $request->input('org_active'), 'category' => $request->input('org_category'), 'text' => $request->input('org_text'), 'rank0' => $request->input('org_rank0'), 'rank1' => $request->input('org_rank1'), 'rank2' => $request->input('org_rank2'), 'rank3' => $request->input('org_rank3'), 'rank4' => $request->input('org_rank4'), 'rank5' => $request->input('org_rank5'), 'rank6' => $request->input('org_rank6'), 'rank7' => $request->input('org_rank7'), 'rank8' => $request->input('org_rank8'), 'rank9' => $request->input('org_rank9')]);
     flash()->success('Udało Ci się utworzyć organizację o nazwie <b>' . $request->input('org_name') . '</b>!');
     return redirect('/admin/organization');
 }
コード例 #16
0
 /**
  * Store a newly created resource in storage.
  *
  * @param OrganizationRequest $request
  * @return Response
  */
 public function store(OrganizationRequest $request)
 {
     $organization = Organization::create($request->all());
     session()->flash('flash_message', "The organization \"{$organization->name}\" has been created.");
     return redirect('organizations');
 }
コード例 #17
0
 public function store()
 {
     $store = Request::all();
     //return $store;
     $organization = Organization::create($store);
     $organization->addUser($this->getAuthUser());
     $this->getAuthUser()->leadsOrgs()->save($organization);
     return redirect('/home/organizations');
 }
コード例 #18
0
ファイル: FakeSeeder.php プロジェクト: ppawlas/swop
 /**
  * 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();
     foreach (range(1, 5) as $index) {
         Indicator::create(['name' => $faker->sentence(3), 'function_name' => $faker->numerify($faker->sentence(3) . '###'), 'type' => $faker->randomElement(['value', 'ratio']), 'default_coefficient' => $faker->randomFloat(3, 0, 1), 'description' => $faker->text()]);
     }
     foreach (range(1, 5) as $index) {
         $organization = Organization::create(['code' => $faker->randomNumber(6), 'name' => $faker->company, 'active' => $faker->boolean()]);
         foreach (Indicator::all() as $indicator) {
             $organization->indicators()->attach($indicator->id, ['coefficient' => $faker->randomFloat(3, 0, 10)]);
         }
     }
     foreach (range(1, 100) as $index) {
         $organization = Organization::all()->random(1);
         $user = User::create(['login' => $organization->code . '_' . $faker->userName, 'name' => $faker->firstName, 'surname' => $faker->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->sentence(3)]);
             $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(2, 5));
             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->date('Y-m-d');
             $report = Report::create(['owner_id' => $manager->id, 'name' => $faker->sentence(4), 'start_date' => $faker->date('Y-m-d', $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();
 }