本文整理汇总了PHP中app\models\Company::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Company::create方法的具体用法?PHP Company::create怎么用?PHP Company::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Company
的用法示例。
在下文中一共展示了Company::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testAssetAdd
public function testAssetAdd()
{
$company = factory(Company::class, 'company')->make();
$values = ['name' => $company->name];
Company::create($values);
$this->tester->seeRecord('companies', $values);
}
示例2: store
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']);
}
示例3: store
/**
* 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('do-not-reply@safeworksite.net');
$m->to($email_list);
$m->subject('New Company Notification');
});
Toastr::success("Created new company");
return view('company.list');
}
示例4: run
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!');
}
}
示例5: run
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);
}
}
示例6: run
/**
* 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());
}
}
示例7: run
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' => 'jon.gravois@sfa.com', 'mail_domain' => 'sfa.org', 'website' => 'http://acad.sfa.org/', 'corporation_type' => 'San Francisco', 'admin_id' => 2]];
foreach ($collection as $record) {
Company::create($record);
}
}
示例8: run
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' => 'jon.gravois@rhsps.com', 'website' => 'http://acad.sfi.org/', 'corporation_type' => 'San Francisco']];
foreach ($collection as $record) {
Company::create($record);
}
}
示例9: trialRegister
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'] = 'Password is required.';
}
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);
}
示例10: run
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);
}
}
示例11: run
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]);
}
示例12: update
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);
}
示例13: run
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]);
}
示例14: profile
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'));
}
示例15: store
/**
* 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");
}