本文整理汇总了PHP中app\models\Company类的典型用法代码示例。如果您正苦于以下问题:PHP Company类的具体用法?PHP Company怎么用?PHP Company使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Company类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionCompany
public function actionCompany()
{
$company = Company::find()->one();
if (empty($company)) {
$company = new Company();
$company->vat = 0;
$company->logo = '';
}
$post = Yii::$app->request->post();
if (!empty($post)) {
if (!empty($_FILES['Company']['name']['logo'])) {
$tmp_name = $_FILES['Company']['tmp_name']['logo'];
$name = $_FILES['Company']['name']['logo'];
if (file_exists('upload/' . $name)) {
unlink('upload' . $name);
}
if (move_uploaded_file($tmp_name, 'upload/' . $name)) {
$company->logo = $name;
}
}
$company->name = $post['Company']['name'];
$company->tax_code = $post['Company']['tax_code'];
$company->tel = $post['Company']['tel'];
$company->website = $post['Company']['website'];
$company->address = $post['Company']['address'];
$company->vat = $post['Company']['vat'];
if ($company->save()) {
$session = new Session();
$session->setFlash('message', 'บันทึกรายการแล้ว');
return $this->redirect(['company']);
}
}
return $this->render('//config/company', ['company' => $company]);
}
示例2: actionCompany
public function actionCompany()
{
$model = new Company();
if ($model->load(Yii::$app->request->post())) {
if ($model->validate()) {
$model->is_sponsor = 0;
$model->is_organisator = 0;
$model->save();
Yii::$app->session->setFlash('success', 'Thank you for contacting us. We will respond to you as soon as possible.');
return $this->refresh();
}
}
return $this->render('company', ['model' => $model]);
}
示例3: createCompany
private function createCompany($addressID)
{
$company = new Company();
$company->created_at = date("Y-m-d H:i:s");
$company->name = $this->email;
$company->comment = "";
$company->phone = "";
$company->twenty_four_hours = 0;
$company->active = 1;
$company->status_d = 0;
$company->address_id = $addressID;
$company->save();
return $company->id;
}
示例4: testAssetAdd
public function testAssetAdd()
{
$company = factory(Company::class, 'company')->make();
$values = ['name' => $company->name];
Company::create($values);
$this->tester->seeRecord('companies', $values);
}
示例5: getCompaniesLogo
private function getCompaniesLogo()
{
$organisators = Company::find()->where(['is_organisator' => '1'])->orderBy('order')->all();
$organisatorsAndMembers = [];
foreach ($organisators as $value) {
$organisatorsAndMembers[$value->attributes['id']]['name'] = $value->attributes['name'];
if ($value->attributes['logo_url'] != '') {
$organisatorsAndMembers[$value->attributes['id']]['url'] = 'http://' . Yii::$app->request->serverName . $value->attributes['logo_url'];
} else {
$organisatorsAndMembers[$value->attributes['id']]['url'] = 'http://' . Yii::$app->request->serverName . '/files/logo/no_logo.jpg';
}
$organisatorsAndMembers[$value->attributes['id']]['intro'] = $value->attributes['intro_' . Yii::$app->language];
$organisatorsAndMembers[$value->attributes['id']]['site'] = $value->attributes['site'];
}
$members = Company::find()->where(['is_sponsor' => '1'])->orderBy('order')->all();
foreach ($members as $value) {
$organisatorsAndMembers[$value->attributes['id']]['name'] = $value->attributes['name'];
if ($value->attributes['logo_url'] != '') {
$organisatorsAndMembers[$value->attributes['id']]['url'] = 'http://' . Yii::$app->request->serverName . $value->attributes['logo_url'];
} else {
$organisatorsAndMembers[$value->attributes['id']]['url'] = 'http://' . Yii::$app->request->serverName . '/files/logo/no_logo.jpg';
}
$organisatorsAndMembers[$value->attributes['id']]['intro'] = $value->attributes['intro_' . Yii::$app->language];
$organisatorsAndMembers[$value->attributes['id']]['site'] = $value->attributes['site'];
}
return $organisatorsAndMembers;
}
示例6: 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);
}
}
示例7: 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());
}
}
示例8: 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);
}
}
示例9: 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);
}
}
示例10: 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!');
}
}
示例11: 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);
}
示例12: 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);
}
}
示例13: saveInfo
public function saveInfo()
{
$company = Company::findOne($this->id);
if ($company) {
$company->setComment($this->info);
return true;
}
return false;
}
示例14: 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]);
}
示例15: run
public function run()
{
$person = DB::table('people')->where('first_name', 'James')->where('last_name', 'Sample')->first();
$company = Company::where('name', 'Sample Company')->first();
$group_type = GroupType::where('name', 'employee')->first();
$group = Group::where('name', 'e80-helpdesk')->first();
if (isset($person)) {
CompanyPerson::create(['person_id' => $person->id, 'company_id' => $company->id, 'group_type_id' => $group_type->id, 'group_id' => $group->id]);
}
}