Beispiel #1
0
 public function testAssetAdd()
 {
     $company = factory(Company::class, 'company')->make();
     $values = ['name' => $company->name];
     Company::create($values);
     $this->tester->seeRecord('companies', $values);
 }
 public function store(CreateCompanyRequest $request)
 {
     $company = Company::create($request->all());
     if (!Input::get('person_id')) {
         $person = new Person();
         $person->first_name = Input::get('person_fn');
         $person->last_name = Input::get('person_ln');
         $person->save();
     }
     $contact = new CompanyPerson();
     $contact->company_id = $company->id;
     $contact->person_id = Input::get('person_id') ? Input::get('person_id') : $person->id;
     $contact->title_id = Input::get('title_id');
     $contact->department_id = Input::get('department_id');
     $contact->phone = Input::get('phone');
     $contact->extension = Input::get('extension');
     $contact->cellphone = Input::get('cellphone');
     $contact->email = Input::get('email');
     $contact->group_type_id = Input::get('company_id') == ELETTRIC80_COMPANY_ID ? EMPLOYEE_GROUP_TYPE_ID : CUSTOMER_GROUP_TYPE_ID;
     $contact->group_id = Input::get('company_id') == ELETTRIC80_COMPANY_ID ? DEFAULT_EMPLOYEE_GROUP_ID : DEFAULT_CUSTOMER_GROUP_ID;
     $contact->save();
     $company_main_contact = new CompanyMainContact();
     $company_main_contact->company_id = $company->id;
     $company_main_contact->main_contact_id = $contact->id;
     $company_main_contact->save();
     $company_account_manager = new CompanyAccountManager();
     $company_account_manager->company_id = $company->id;
     $company_account_manager->account_manager_id = Input::get('account_manager_id');
     $company_account_manager->save();
     return redirect()->route('companies.index')->with('successes', ['company created successfully']);
 }
Beispiel #3
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(CompanyRequest $request)
 {
     // Check authorisation and throw 404 if not
     if (!Auth::user()->allowedTo('add', 'company')) {
         return view('errors/404');
     }
     // Create Company
     $company_request = $request->except('supervisors', 'trades');
     $newCompany = Company::create($company_request);
     // Update trades + supervisors for company
     if ($request->get('trades')) {
         $newCompany->tradesSkilledIn()->sync($request->get('trades'));
     }
     if ($request->get('supervisors')) {
         $newCompany->supervisedBy()->sync($request->get('supervisors'));
     }
     // Email new Company
     $email_list = "tara@capecod.com.au; company@capecod.com.au";
     $email_list = explode(';', $email_list);
     $email_list = array_map('trim', $email_list);
     // trim white spaces
     $email_user = Auth::user()->email;
     $data = ['date' => $newCompany->created_at->format('d/m/Y g:i a'), 'name' => $newCompany->name, 'address' => $newCompany->address . ' ' . $newCompany->SuburbStatePostcode, 'phone' => $newCompany->phone, 'email' => $newCompany->email, 'created_by' => Auth::user()->fullname, 'user_company' => Auth::user()->company->name];
     Mail::send('emails/new-company', $data, function ($m) use($email_list) {
         $m->from('*****@*****.**');
         $m->to($email_list);
         $m->subject('New Company Notification');
     });
     Toastr::success("Created new company");
     return view('company.list');
 }
 public function run()
 {
     $faker = Faker\Factory::create();
     foreach (range(1, 30) as $index) {
         Company::create(['company_name' => $faker->company]);
         $this->command->info('Company table seeded!');
     }
 }
 public function run()
 {
     DB::table('companies')->delete();
     $collection = [['company' => 'UAM'], ['company' => 'ADC'], ['company' => 'Boeing'], ['company' => 'Southwest'], ['company' => 'Jet Blue'], ['company' => 'Robert Half']];
     foreach ($collection as $record) {
         Company::create($record);
     }
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $objs = factory(Company::class, 10)->make();
     Company::truncate();
     foreach ($objs as $var) {
         Company::create($var->toArray());
     }
 }
 public function run()
 {
     DB::table('companies')->delete();
     $collection = [['company' => 'Dagobah Charters', 'dba' => 'DCY', 'domain' => 'dagobah.com', 'folder_name' => snake_case('Dagobah Charters'), 'tier' => '2', 'corporation_type' => 'Limited Liability Corporation', 'admin_id' => 4], ['company' => 'Aerospace Disassembly Consortium', 'dba' => 'ADC', 'domain' => 'aero-eco.com', 'folder_name' => snake_case('Aerospace Disassembly Consortium'), 'tier' => '1', 'corporation_type' => 'Tennessee', 'admin_id' => 9], ['company' => 'Universal Asset Management', 'dba' => 'UAM', 'main_phone' => '9016824064', 'domain' => 'uaminc.com', 'folder_name' => snake_case('Universal Asset Management'), 'tier' => '2', 'corporation_type' => 'Tennessee', 'admin_id' => 6], ['company' => 'Braniff Airlines', 'dba' => 'Braniff', 'domain' => 'braniff.com', 'folder_name' => snake_case('Braniff Airlines'), 'tier' => '3', 'corporation_type' => 'Limited Liability Corporation', 'admin_id' => 3], ['company' => 'Starfleet Academy', 'dba' => 'SFA', 'main_phone' => '4155551212', 'domain' => 'sfa.org', 'folder_name' => snake_case('Starfleet Academy'), 'tier' => '4', 'reply_to' => '*****@*****.**', 'mail_domain' => 'sfa.org', 'website' => 'http://acad.sfa.org/', 'corporation_type' => 'San Francisco', 'admin_id' => 2]];
     foreach ($collection as $record) {
         Company::create($record);
     }
 }
 public function run()
 {
     DB::table('companies')->delete();
     $collection = [['company' => 'Dagobah Charters', 'dba' => 'DCY', 'domain' => 'dagobah.com', 'tier' => '2', 'corporation_type' => 'Limited Liability Corporation'], ['company' => 'Aerospace Disassembly Consortium', 'dba' => 'ADC', 'domain' => 'aero-eco.com', 'tier' => '1', 'corporation_type' => 'Tennessee'], ['company' => 'Universal Asset Management', 'dba' => 'UAM', 'domain' => 'uaminc.com', 'tier' => '2', 'corporation_type' => 'Tennessee'], ['company' => 'Braniff Airlines', 'dba' => 'Braniff', 'domain' => 'braniff.com', 'tier' => '3', 'corporation_type' => 'Limited Liability Corporation'], ['company' => 'Starfleet Academy', 'dba' => 'SFA', 'domain' => 'sfa.org', 'tier' => '4', 'reply_to' => '*****@*****.**', 'website' => 'http://acad.sfi.org/', 'corporation_type' => 'San Francisco']];
     foreach ($collection as $record) {
         Company::create($record);
     }
 }
Beispiel #9
0
 public function trialRegister(Request $request)
 {
     $errors = [];
     $data = [];
     $email = $request->input('email');
     $password = $request->input('password');
     $password2 = $request->input('password2');
     $country_id = $request->input('country_id');
     $company = $request->input('company');
     $dba = $request->input('dba');
     $firstname = $request->input('firstname');
     $lastname = $request->input('lastname');
     $phone = $request->input('phone');
     $can_sell = $request->input('can_sell');
     $terms_agree = $request->input('terms_agree');
     $contact_please = $request->input('contact_please');
     if (!$email) {
         $errors['email'] = 'Email is required.';
     }
     if (!$password) {
         $errors['password'] = '******';
     }
     if (!$password2) {
         $errors['password2'] = 'Confirmation of password is required.';
     }
     if (!$company) {
         $errors['company'] = 'Company legal name is required.';
     }
     if (!$dba) {
         $errors['dba'] = 'Company common name is required.';
     }
     if (!$firstname) {
         $errors['firstname'] = 'First Name is required.';
     }
     if (!$lastname) {
         $errors['lastname'] = 'Last Name is required.';
     }
     if (!$phone) {
         $errors['phone'] = 'Phone Number is required.';
     }
     if (!empty($errors)) {
         $data['success'] = false;
         $data['errors'] = $errors;
     } else {
         // process form
         $newco = Company::create(['company' => $company, 'dba' => $dba, 'country_id' => $country_id, 'terms_agree' => $terms_agree, 'contact_please' => $contact_please, 'can_sell' => $can_sell, 'main_phone' => $phone, 'tier' => 2, 'folder_name' => snake_case($company)]);
         $newuser = User::create(['firstname' => $firstname, 'lastname' => $lastname, 'email' => $email, 'password' => bcrypt($password), 'company_id' => $newco->id, 'can_sell' => $can_sell]);
         $updCo = $newco->fill(['admin_id' => $newuser->id])->save();
         $updU = $newuser->fill(['manager_id' => $newuser->id])->save();
         $data['success'] = true;
         $data['message'] = 'Success';
         $data['user_id'] = $newuser->id;
         $data['company_id'] = $newco->id;
     }
     // end if
     return $this->respond($data);
 }
 public function run()
 {
     DB::table('companies')->truncate();
     $faker = Faker\Factory::create('pt_BR');
     for ($i = 0; $i < 1000; $i++) {
         $company = ['name' => $faker->company, 'city' => $faker->city, 'phone' => $faker->phoneNumber];
         Company::create($company);
     }
 }
 public function run()
 {
     $this->command->info('Running UserTableSeeder');
     Eloquent::unguard();
     $faker = Faker\Factory::create();
     $company = Company::create();
     $account = Account::create(['name' => $faker->name, 'address1' => $faker->streetAddress, 'address2' => $faker->secondaryAddress, 'city' => $faker->city, 'state' => $faker->state, 'postal_code' => $faker->postcode, 'country_id' => Country::all()->random()->id, 'account_key' => str_random(RANDOM_KEY_LENGTH), 'invoice_terms' => $faker->text($faker->numberBetween(50, 300)), 'work_phone' => $faker->phoneNumber, 'work_email' => $faker->safeEmail, 'invoice_design_id' => min(InvoiceDesign::all()->random()->id, 10), 'header_font_id' => min(Font::all()->random()->id, 17), 'body_font_id' => min(Font::all()->random()->id, 17), 'primary_color' => $faker->hexcolor, 'timezone_id' => 1, 'company_id' => $company->id]);
     User::create(['email' => TEST_USERNAME, 'username' => TEST_USERNAME, 'account_id' => $account->id, 'password' => Hash::make(TEST_PASSWORD), 'registered' => true, 'confirmed' => true, 'notify_sent' => false, 'notify_paid' => false]);
     Affiliate::create(['affiliate_key' => SELF_HOST_AFFILIATE_KEY]);
 }
 public function update($id)
 {
     // save updated
     $record = $this->records->find($id);
     if (!$record) {
         Company::create(Input::all());
         return $this->respond($record);
     }
     $record->fill(Input::all())->save();
     return $this->respond($record);
 }
 public function run()
 {
     $this->command->info('Running UserTableSeeder');
     Eloquent::unguard();
     $faker = Faker\Factory::create();
     $company = Company::create();
     $account = Account::create(['name' => $faker->name, 'address1' => $faker->streetAddress, 'address2' => $faker->secondaryAddress, 'city' => $faker->city, 'state' => $faker->state, 'postal_code' => $faker->postcode, 'country_id' => Country::all()->random()->id, 'account_key' => str_random(RANDOM_KEY_LENGTH), 'invoice_terms' => $faker->text($faker->numberBetween(50, 300)), 'work_phone' => $faker->phoneNumber, 'work_email' => $faker->safeEmail, 'invoice_design_id' => InvoiceDesign::where('id', '<', CUSTOM_DESIGN)->get()->random()->id, 'header_font_id' => min(Font::all()->random()->id, 17), 'body_font_id' => min(Font::all()->random()->id, 17), 'primary_color' => $faker->hexcolor, 'timezone_id' => 1, 'company_id' => $company->id]);
     $user = User::create(['first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'email' => TEST_USERNAME, 'username' => TEST_USERNAME, 'account_id' => $account->id, 'password' => Hash::make(TEST_PASSWORD), 'registered' => true, 'confirmed' => true, 'notify_sent' => false, 'notify_paid' => false, 'is_admin' => 1]);
     $client = Client::create(['user_id' => $user->id, 'account_id' => $account->id, 'public_id' => 1, 'name' => $faker->name, 'address1' => $faker->streetAddress, 'address2' => $faker->secondaryAddress, 'city' => $faker->city, 'state' => $faker->state, 'postal_code' => $faker->postcode, 'country_id' => DEFAULT_COUNTRY, 'currency_id' => DEFAULT_CURRENCY]);
     Contact::create(['user_id' => $user->id, 'account_id' => $account->id, 'client_id' => $client->id, 'public_id' => 1, 'email' => env('TEST_EMAIL', TEST_USERNAME), 'is_primary' => true]);
     Product::create(['user_id' => $user->id, 'account_id' => $account->id, 'public_id' => 1, 'product_key' => 'ITEM', 'notes' => 'Something nice...', 'cost' => 10]);
     Affiliate::create(['affiliate_key' => SELF_HOST_AFFILIATE_KEY]);
 }
Beispiel #14
0
 public function profile($id = null)
 {
     if (!$id) {
         $id = Company::create()->id;
         $newed = Company::findOrFail($id);
         event(new CompanyWasCreated($newed));
         return redirect('companies/' . $id . '/profile');
     } else {
         $company = Company::with($this->related)->where('id', $id)->first();
     }
     $countries = Country::lists('country', 'id');
     //return $company;
     return view('companies.profile', compact('company', 'countries'));
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(CompaniesRequest $request)
 {
     $data = $request->only('name', 'contact', 'email', 'address', 'website', 'contact_person');
     // dd($data);
     $company = Company::create($data);
     // $company = Company::create([
     //   	'name' => $request->input("name"),
     //   	'contact' => $request->input("contact"),
     //   	'email' => $request->input("email"),
     //   	'address' => $request->input("address"),
     //   	'website' => $request->input("website"),
     //   	'contact_person' => $request->input("contact_person"),
     // ]);
     return redirect("/companies");
 }
Beispiel #16
0
 public function store(Requests\CreateCompanyRequest $request)
 {
     $company = Company::create($request->all());
     $company->addType($request->get('type'));
     return redirect()->route('admin.company')->with('Success', 'Bedrijf is toegevoegd');
 }
Beispiel #17
0
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 protected function create(array $data)
 {
     $comp = Company::create(['name' => $data['company'], 'date' => date("Y-m-d")]);
     return User::create(['name' => $data['name'], 'last_name' => $data['lastName'], 'email' => $data['email'], 'password' => bcrypt($data['password']), 'company_id' => $comp->id, 'position' => 1]);
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     DB::table('payables')->delete();
     DB::table('payable_types')->delete();
     DB::table('job_order_jobs')->delete();
     DB::table('job_orders')->delete();
     DB::table('jobs')->delete();
     DB::table('customer_phones')->delete();
     DB::table('customers')->delete();
     DB::table('users')->delete();
     DB::table('companies')->delete();
     $companies = [];
     foreach (range(0, 2) as $x) {
         $companies[] = \App\Models\Company::create(['name' => "Empresa {$x}", 'email' => "empresa{$x}@teste.com.br", 'cnpj' => '81.748.407/0001-01', 'ie' => '309.639.790.252', 'address' => "Endereço da Empresa {$x}", 'number' => $x, 'district' => "Bairro de Teste {$x}", 'city' => "Cidade de Teste {$x}", 'state' => "Teste", 'zip' => '00000-0' . str_pad($x, 2, '0', STR_PAD_LEFT), 'contact' => "Pessoa de Teste {$x}"]);
     }
     $cid = 0;
     foreach ($companies as $company) {
         $cid += 1;
         User::create(['name' => 'Teste', 'email' => "teste{$cid}@teste.com.br", 'password' => Hash::make('teste')])->company()->associate($company)->save();
         $jobs = [];
         foreach (range(0, 15) as $x) {
             $job = Job::create(['name' => "Serviço de teste {$cid}/{$x}", 'price' => $x * 100, 'description' => "Serviço de teste {$x}"])->company()->associate($company);
             $job->save();
             $jobs[] = $job;
         }
         $customers = [];
         foreach (range(0, 15) as $x) {
             $customer = Customer::create(['name' => "Cliente {$cid}/{$x}", 'email' => "cliente{$x}@teste.com.br", 'cnpj' => '81.748.407/0001-01', 'ie' => '309.639.790.252', 'address' => "Endereço de Teste {$x}", 'number' => $x, 'district' => "Bairro de Teste {$x}", 'city' => "Cidade de Teste {$x}", 'state' => "Teste", 'zip' => '00000-0' . str_pad($x, 2, '0', STR_PAD_LEFT), 'contact' => "Pessoa de Teste {$x}"])->company()->associate($company);
             $customer->save();
             foreach (range(0, rand(1, 5)) as $y) {
                 $customer->phones()->create(['phone' => "1398765432{$y}"]);
             }
             $testJobs = array_pick_index($jobs, array_rand($jobs, 5));
             $customerJobOrder = JobOrder::create(['customer_id' => $customer->id, 'note' => "Nota de teste para o cliente {$cid}/{$x}"])->company()->associate($company);
             $customerJobOrder->save();
             $testJobs = array_map(function ($item) {
                 return ['job_id' => $item->id, 'price' => $item->price];
             }, $testJobs);
             $customerJobOrder->jobs()->sync($testJobs);
             $customerJobOrder->save();
             $customers[] = $customer;
         }
         $payableTypes = [];
         foreach (range(0, 15) as $i) {
             $payableType = PayableType::create(['name' => "Conta de Teste {$cid}/{$i}", 'description' => "Descrição do tipo {$i}"])->company()->associate($company);
             $payableType->save();
             $payableTypes[] = $payableType;
         }
         $payables = [];
         foreach ($customers as $customer) {
             foreach (range(0, rand(1, 5)) as $x) {
                 $type = current(array_pick_index($payableTypes, array_rand($payableTypes, 5)));
                 $payable = \App\Models\Payable::create(['payable_type_id' => $type->id, 'date' => \Carbon\Carbon::now()->addDays(rand(1, 60)), 'status' => rand(1, 2), 'price' => $x * 100, 'description' => "Descrição de uma conta a pagar {$customer->id}/{$x}"])->company()->associate($company);
                 $payable->save();
                 $payables[] = $payable;
             }
         }
     }
     Model::reguard();
 }
Beispiel #19
0
Route::get('auth/register/{tier}', 'Auth\\AuthController@getRegister');
Route::post('auth/register', 'Auth\\AuthController@postRegister');
Route::post('register', 'AjaxController@trialRegister');
// Password reset link request routes...
Route::get('password/email', 'Auth\\PasswordController@getEmail');
Route::post('password/email', 'Auth\\PasswordController@postEmail');
Route::controllers(['password' => 'Auth\\PasswordController']);
// TEST ROUTES  Jon: 9012870209; Kenn: 8702083769; Tracy: 6624366086
Route::group(['prefix' => 'test/'], function () {
    Route::get('upload', function () {
        return View::make('pages.upload');
    });
    Route::get('project/togglepart/{partid}', 'ProjectsController@togglePartInProject');
    Route::post('apply/upload', 'ApplyController@upload');
    Route::get('newco', function () {
        $newed = Company::create(['company' => 'Apple Computers', 'dba' => 'Apple', 'corporation_type' => 'California', 'country_id' => 184, 'location_id' => 1, 'main_phone' => '7129991200', 'domain' => 'apple.com', 'mail_domain' => 'apple.com', 'folder_name' => 'apple_computers', 'website' => 'http://www.apple.com']);
        event(new CompanyWasCreated($newed));
    });
    Route::get('emailer', function () {
        $data = array('name' => 'Jonathan');
        // Change name
        Mail::send('emails.welcome', $data, function ($message) {
            // Please double-check email address
            $message->to('*****@*****.**')->subject('Hi, there! Laravel sent me!');
        });
        return 'Email Sent!';
    });
    Route::get('xlimport/{dir}/{file}', ['as' => 'xlimport', 'uses' => 'ExcelController@fromExcel']);
    Route::get('event', function () {
        logit('created a test event');
    });
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Company::truncate();
     $companies = ["Vodacom", "MTN", "BMW", "SITA", "City of Tshwane", "Telkom", "Accenture", "Innovation Hub", "Mlab"];
     foreach ($companies as $company) {
         $r = Company::create(["name" => $company, "contact" => '0400004442', "email" => '*****@*****.**', "address" => 'ss', "website" => 'www.one.com', "contact_person" => '']);
     }
 }
 public function run()
 {
     Company::create(['name' => 'Sample Company']);
 }
 private function upAccounts($primaryAccount, $otherAccounts = array())
 {
     if (!$primaryAccount) {
         $primaryAccount = $otherAccounts->first();
     }
     if (empty($primaryAccount)) {
         return;
     }
     $company = Company::create();
     if ($primaryAccount->pro_plan_paid && $primaryAccount->pro_plan_paid != '0000-00-00') {
         $company->plan = 'pro';
         $company->plan_term = 'year';
         $company->plan_started = $primaryAccount->pro_plan_paid;
         $company->plan_paid = $primaryAccount->pro_plan_paid;
         $expires = DateTime::createFromFormat('Y-m-d', $primaryAccount->pro_plan_paid);
         $expires->modify('+1 year');
         $expires = $expires->format('Y-m-d');
         // check for self host white label licenses
         if (!Utils::isNinjaProd()) {
             if ($company->plan_paid) {
                 $company->plan = 'white_label';
                 // old ones were unlimited, new ones are yearly
                 if ($company->plan_paid == NINJA_DATE) {
                     $company->plan_term = null;
                 } else {
                     $company->plan_term = PLAN_TERM_YEARLY;
                     $company->plan_expires = $expires;
                 }
             }
         } elseif ($company->plan_paid != NINJA_DATE) {
             $company->plan_expires = $expires;
         }
     }
     if ($primaryAccount->pro_plan_trial && $primaryAccount->pro_plan_trial != '0000-00-00') {
         $company->trial_started = $primaryAccount->pro_plan_trial;
         $company->trial_plan = 'pro';
     }
     $company->save();
     $primaryAccount->company_id = $company->id;
     $primaryAccount->save();
     if (!empty($otherAccounts)) {
         foreach ($otherAccounts as $account) {
             if ($account && $account->id != $primaryAccount->id) {
                 $account->company_id = $company->id;
                 $account->save();
             }
         }
     }
 }
Beispiel #23
0
 /**
  * Migrate Companies
  */
 public function companys()
 {
     echo "<h1>Migrating Companies</h1>";
     $companys = zCompany::all();
     $companys->each(function ($company) {
         if ($company->id != '12') {
             echo "<b>" . $company->name . "</b><br>";
             $active = '0';
             if ($company->active == "y") {
                 $active = '1';
             }
             $trans = '0';
             if ($company->transit == "y") {
                 $trans = '1';
             }
             $newCompany = Company::create(array('name' => reformatOldStr($company->name), 'address' => $company->address, 'suburb' => $company->suburb, 'state' => $company->state, 'postcode' => $company->postcode, 'phone' => $company->phone, 'transient' => $trans, 'maxjobs' => $company->maxjobs, 'notes' => $company->notes, 'status' => $active, 'phone' => $company->phone, 'parent_company' => '3', 'created_by' => '1', 'updated_by' => '1'));
             // Add trades to created company
             $trades = explode(':', $company->trade_id);
             echo $company->trade_id;
             if ($trades) {
                 foreach ($trades as $trade_id) {
                     if ($trade_id) {
                         $lookup = DB::table('z_lookup_trades')->where('old', $trade_id)->get();
                         $newCompany->tradesSkilledIn()->attach($lookup[0]->new);
                         echo " [{$trade_id}]->[" . $lookup[0]->new . "]";
                     }
                 }
             }
             // Add to lookup
             zLookupCompany::create(array('old' => $company->id, 'new' => $newCompany->id));
             echo "<br>";
         }
     });
     echo "<h1>Completed</h1>";
 }
 public function unlinkUser($userAccountId, $userId)
 {
     $userAccount = UserAccount::whereId($userAccountId)->first();
     if ($userAccount->hasUserId($userId)) {
         $userAccount->removeUserId($userId);
         $userAccount->save();
     }
     $user = User::whereId($userId)->first();
     if (!$user->public_id && $user->account->company->accounts->count() > 1) {
         $company = Company::create();
         $company->save();
         $user->account->company_id = $company->id;
         $user->account->save();
     }
 }