本文整理汇总了PHP中Company::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Company::create方法的具体用法?PHP Company::create怎么用?PHP Company::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Company
的用法示例。
在下文中一共展示了Company::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
Company::create([]);
}
}
示例2: run
public function run()
{
$faker = Faker::create();
Company::deleteAll();
foreach (range(1, 10) as $index) {
Company::create(['title' => $faker->company, 'address' => $faker->streetAddress, 'phone' => $faker->phoneNumber]);
}
}
示例3: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$input = Input::only('rut', 'fancy_name', 'description', 'adress', 'city', 'location', 'phone_number');
$company = Company::create($input);
$products = Input::only("productos");
//Insert products in pivot table company_product
Event::fire('company.created', [$products, $company]);
return Redirect::action('AdminsController@index');
}
示例4: run
/**
* Run the user seeds.
*
* @return void
*/
public function run()
{
DB::table('companies')->delete();
DB::table('users_companies')->delete();
$visible = Company::create(array('name' => 'Visible', 'user_id' => 1));
$invisible = Company::create(array('name' => 'Invisible', 'user_id' => 1));
UserCompany::create(array('company_id' => $visible->id, 'user_id' => 1));
UserCompany::create(array('company_id' => $invisible->id, 'user_id' => 2));
}
示例5: store
public function store()
{
$input = Input::all();
$validator = Validator::make($input, $this->rules);
if ($validator->passes()) {
$company = Company::create(array('user_id' => Sentry::getUser()->id, 'name' => $input['name']));
UserCompany::create(array('company_id' => $company->id, 'user_id' => $company->user_id));
Session::flash('success', trans('company.create.success', array('name' => $company->name)));
return Redirect::route('company.show', array('id' => $company->id));
}
return Redirect::back()->withErrors($validator)->withInput($input);
}
示例6: addCustCompany
public function addCustCompany()
{
$comp = Company::get();
$isAdded = FALSE;
$validInput = TRUE;
$regex = "/^[a-zA-Z\\'\\-\\.\\,]+( [a-zA-Z\\'\\-\\.\\,]+)*\$/";
$regexName = "/^[a-zA-Z\\'\\-]+( [a-zA-Z\\'\\-]+)*\$/";
$regexHouse = "/[0-9a-zA-Z\\-\\s]+\$/";
$regexStreet = "/^[a-zA-Z0-9\\'\\-\\.]+( [a-zA-Z0-9\\'\\-\\.]+)*\$/";
$regexBarangay = "/^[a-zA-Z0-9\\'\\-\\.]+( [a-zA-Z0-9\\'\\-\\.]+)*\$/";
$regexCity = "/^[a-zA-Z\\'\\-]+( [a-zA-Z\\'\\-]+)*\$/";
$regexZip = "/^[0-9]+\$/";
$regexProvince = "/^[a-zA-Z\\'\\-]+( [a-zA-Z\\'\\-]+)*\$/";
if (!trim(Input::get('addComName')) == '' && !trim(Input::get('addConPerson')) == '' && !trim(Input::get('addCustCompanyHouseNo')) == '' && !trim(Input::get('addComEmailAddress')) == '' && !trim(Input::get('addCustCompanyStreet')) == '' && !trim(Input::get('addCustCompanyCity')) == '' && !trim(Input::get('addCel')) == '') {
$validInput = TRUE;
if (preg_match($regex, Input::get('addComName')) && preg_match($regexName, Input::get('addConPerson')) && preg_match($regexHouse, Input::get('addCustCompanyHouseNo')) && !!filter_var(Input::get('addComEmailAddress'), FILTER_VALIDATE_EMAIL) && preg_match($regexStreet, Input::get('addCustCompanyStreet')) && preg_match($regexCity, Input::get('addCustCompanyCity'))) {
$validInput = TRUE;
if (!trim(Input::get('addCustCompanyZipCode')) == '' || !trim(Input::get('addCustCompanyProvince')) == '' || !trim(Input::get('addCustCompanyBarangay')) == '') {
if (preg_match($regexZip, Input::get('addCustCompanyZipCode')) || preg_match($regexProvince, Input::get('addCustCompanyProvince')) || preg_match($regexBarangay, Input::get('addCustCompanyBarangay'))) {
$validInput = TRUE;
} else {
$validInput = FALSE;
}
}
} else {
$validInput = FALSE;
}
} else {
$validInput = FALSE;
}
$count = DB::table('tblCustCompany')->select('tblCustCompany.strCustCompanyEmailAddress')->where('tblCustCompany.strCustCompanyEmailAddress', '=', trim(Input::get('addComEmailAddress')))->count();
$count2 = DB::table('tblCustCompany')->select('tblCustCompany.strCustCompanyCPNumber')->where('tblCustCompany.strCustCompanyCPNumber', '=', trim(Input::get('addCel')))->count();
if ($count > 0 || $count2 > 0) {
$isAdded = TRUE;
} else {
foreach ($comp as $comp) {
if (strcasecmp($comp->strCustCompanyName, trim(Input::get('addComName'))) == 0 || strcasecmp($comp->strCustContactPerson, trim(Input::get('addConPerson'))) == 0) {
$isAdded = TRUE;
}
}
}
if ($validInput) {
if (!$isAdded) {
$company = Company::create(array('strCustCompanyID' => Input::get('addComID'), 'strCustCompanyName' => trim(Input::get('addComName')), 'strCustCompanyHouseNo' => trim(Input::get('addCustCompanyHouseNo')), 'strCustCompanyStreet' => trim(Input::get('addCustCompanyStreet')), 'strCustCompanyBarangay' => trim(Input::get('addCustCompanyBarangay')), 'strCustCompanyCity' => trim(Input::get('addCustCompanyCity')), 'strCustCompanyProvince' => trim(Input::get('addCustCompanyProvince')), 'strCustCompanyZipCode' => trim(Input::get('addCustCompanyZipCode')), 'strCustContactPerson' => trim(Input::get('addConPerson')), 'strCustCompanyEmailAddress' => trim(Input::get('addComEmailAddress')), 'strCustCompanyCPNumber' => trim(Input::get('addCel')), 'strCustCompanyCPNumberAlt' => trim(Input::get('addCelAlt')), 'strCustCompanyTelNumber' => trim(Input::get('addPhone')), 'strCustCompanyFaxNumber' => trim(Input::get('addFax')), 'boolIsActive' => 1));
$company->save();
return Redirect::to('/maintenance/customerCompany?success=true');
} else {
return Redirect::to('/maintenance/customerCompany?success=duplicate');
}
} else {
return Redirect::to('/maintenance/customerCompany?input=invalid');
}
}
示例7: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Eloquent::unguard();
DB::table('companies')->delete();
DB::table('items')->delete();
DB::table('categories')->delete();
$territory = Territory::where('name', 'Stockholms län')->where('county', '01')->first();
$company1 = Company::create(array('id' => 1, 'name' => '北欧工作室', 'description' => 'chenyipingsheng: 如何设计api,应该先按模块拆分原则进行初步划分。(4) api返回数据文章中所说的对null的看法...
app后端设计(10)--数据增量更新
chenyipingsheng: 文章中update_time的时间粒度选择的是分钟,如果某个时间段内新增的条数/分钟,超过了单页si...', 'territory_id' => $territory->id, 'url' => 'http://www.google.com', 'address' => '啊发扩大浪费大斗进发觉啦地方', 'established_year' => '2011'));
$company2 = Company::create(array('id' => 2, 'name' => '阿呆姆斯工作室', 'description' => 'chenyipingsheng: 如何设计api,应该先按模块拆分原则进行初步划分。(4) api返回数据文章中所说的对null的看法...
app后端设计(10)--数据增量更新
chenyipingsheng: 文章中update_time的时间粒度选择的是分钟,如果某个时间段内新增的条数/分钟,超过了单页si...', 'territory_id' => $territory->id, 'url' => 'http://www.google.com', 'address' => '饿我热哦我iooewpp', 'established_year' => '2013'));
$item1 = Item::create(array('id' => 1, 'company_id' => 1, 'name' => 'Kayala投资项目', 'description' => '做了3年app相关的系统架构,api设计,先后在3个创业公司中工作,经历过手机网页端,android客户端,iphone客户端,现就职于app云后端平台bmob(想了解bmob点击这里)。其中的乐与苦,得与失,仰首问天有谁知?我觉得是时候来个总结,把相关的技术和心得记录下来。', 'territory_id' => $territory->id, 'url' => 'http://www.google.com', 'min_investment' => 20000000));
$item2 = Item::create(array('id' => 2, 'company_id' => 1, 'name' => '棕熊城堡出售', 'description' => '做了3年app相关的系统架构,api设计,先后在3个创业公司中工作,经历过手机网页端,android客户端,iphone客户端,现就职于app云后端平台bmob(想了解bmob点击这里)。其中的乐与苦,得与失,仰首问天有谁知?我觉得是时候来个总结,把相关的技术和心得记录下来。', 'territory_id' => $territory->id, 'url' => 'http://www.google.com', 'min_investment' => 30000000, 'max_investment' => 30000000));
$item3 = Item::create(array('id' => 3, 'company_id' => 2, 'name' => '布鲁艾尔空气净化器', 'description' => '做了3年app相关的系统架构,api设计,先后在3个创业公司中工作,经历过手机网页端,android客户端,iphone客户端,现就职于app云后端平台bmob(想了解bmob点击这里)。其中的乐与苦,得与失,仰首问天有谁知?我觉得是时候来个总结,把相关的技术和心得记录下来。', 'territory_id' => $territory->id, 'url' => 'http://www.google.com', 'min_investment' => 10000000, 'max_investment' => 10000000));
$item4 = Item::create(array('id' => 4, 'company_id' => 2, 'name' => 'volvo公司转让', 'description' => '做了3年app相关的系统架构,api设计,先后在3个创业公司中工作,经历过手机网页端,android客户端,iphone客户端,现就职于app云后端平台bmob(想了解bmob点击这里)。其中的乐与苦,得与失,仰首问天有谁知?我觉得是时候来个总结,把相关的技术和心得记录下来。', 'territory_id' => $territory->id, 'url' => 'http://www.google.com', 'min_investment' => 250000000, 'max_investment' => 250000000));
Category::create(array('id' => 1, 'name' => '融资项目'));
Category::create(array('id' => 2, 'name' => '房产出售'));
Category::create(array('id' => 3, 'name' => '产品推广'));
Category::create(array('id' => 4, 'name' => '公司转让'));
Category::create(array('id' => 5, 'name' => '技术出售'));
Category::create(array('id' => 6, 'name' => '文化, 媒体, 旅游'));
CompanyCategory::create(array('id' => 1, 'company_id' => 1, 'category_id' => 6));
CompanyCategory::create(array('id' => 2, 'company_id' => 2, 'category_id' => 6));
ItemCategory::create(array('id' => 1, 'item_id' => 1, 'category_id' => 1));
ItemCategory::create(array('id' => 2, 'item_id' => 1, 'category_id' => 2));
ItemCategory::create(array('id' => 3, 'item_id' => 2, 'category_id' => 2));
ItemCategory::create(array('id' => 4, 'item_id' => 3, 'category_id' => 4));
ItemCategory::create(array('id' => 5, 'item_id' => 3, 'category_id' => 5));
ItemCategory::create(array('id' => 6, 'item_id' => 3, 'category_id' => 6));
ItemCategory::create(array('id' => 7, 'item_id' => 4, 'category_id' => 3));
ItemCategory::create(array('id' => 8, 'item_id' => 4, 'category_id' => 5));
Tag::create(array('id' => 1, 'name' => '回报率高'));
Tag::create(array('id' => 2, 'name' => '绿色环保'));
Tag::create(array('id' => 3, 'name' => '市场巨大'));
Tag::create(array('id' => 4, 'name' => '用途广'));
Tag::create(array('id' => 5, 'name' => '历史悠久'));
Tag::create(array('id' => 6, 'name' => '可自雇'));
Tag::create(array('id' => 7, 'name' => 'PM2.5'));
ItemTag::create(array('id' => 1, 'tag_id' => 1, 'item_id' => 1));
ItemTag::create(array('id' => 2, 'tag_id' => 2, 'item_id' => 1));
ItemTag::create(array('id' => 3, 'tag_id' => 3, 'item_id' => 1));
ItemTag::create(array('id' => 4, 'tag_id' => 2, 'item_id' => 2));
ItemTag::create(array('id' => 5, 'tag_id' => 3, 'item_id' => 2));
ItemTag::create(array('id' => 6, 'tag_id' => 4, 'item_id' => 2));
ItemTag::create(array('id' => 7, 'tag_id' => 5, 'item_id' => 3));
ItemTag::create(array('id' => 8, 'tag_id' => 6, 'item_id' => 3));
ItemTag::create(array('id' => 9, 'tag_id' => 7, 'item_id' => 3));
ItemTag::create(array('id' => 10, 'tag_id' => 3, 'item_id' => 4));
ItemTag::create(array('id' => 11, 'tag_id' => 6, 'item_id' => 4));
}
示例8: fire
/**
* Execute the console command
*
* @return void
*/
public function fire()
{
$allowed_types = array('array', 'boolean', 'integer', 'number', 'null', 'object', 'string');
$cluster = Cluster::where('clustername', '=', $this->option('cluster'))->first();
if (!isset($cluster)) {
$this->comment("This cluster doesn't exist.");
return;
}
do {
// get company name
do {
$name = $this->ask("Company name : ");
if (empty($name)) {
$this->comment("Your company name is empty.");
}
} while (empty($name));
// check if a company with this name and cluster already exists
$company = Company::byName($cluster, $name)->first();
if (isset($company)) {
$this->comment("A company with this name already exists, please choose another one.");
}
} while (isset($company));
// get company logo url
do {
$logo_url = $this->ask("Logo url: ");
if (empty($logo_url)) {
$this->comment("Your logo url is empty.");
}
} while (empty($logo_url));
$domains = array();
// get company domains
$add_domains = $this->ask("Do you want to add any domains (like: '@flatturtle.com')? [Y]/n") ? 0 : 1;
while ($add_domains) {
$domain = $this->ask("Domain: ");
if (empty($domain)) {
$this->comment("Your domain is empty.");
}
array_push($domains, $domain);
$add_domains = $this->ask("Do you want to add more domains (like: '@flatturtle.com')? [Y]/n") ? 0 : 1;
}
$company = Company::create(array("name" => $name, "logo_url" => $logo_url, "cluster_id" => $cluster->id, "domains" => json_encode($domains)));
$this->info("Company '{$company->name}' has been saved.");
return;
}
示例9: createCompany
function createCompany(Cluster $cluster, $name)
{
if (!strcmp($cluster->clustername, Auth::user()->clustername) || Auth::user()->isAdmin()) {
// todo pull up method and put it in basecontroller
$content = Request::instance()->getContent();
if (empty($content)) {
return $this->_sendErrorMessage(400, "Payload.Null", "Received payload is empty.");
}
if (Input::json() == null) {
return $this->_sendErrorMessage(400, "Payload.Invalid", "Received payload is invalid.");
}
$validator = Validator::make(Input::json()->all(), array("name" => "required", "logo_url" => "required|url"));
if (!$validator->fails()) {
$company_name = Input::json()->get('name');
$company = Company::byName($cluster->id, $company_name)->first();
// if no domains are included make it an empty array
$domains = Input::json()->get('domains');
if (!isset($domains)) {
$domains = array();
}
//
$data = array("name" => $company_name, "logo_url" => Input::json()->get('logo_url'), "domains" => json_encode($domains));
if (isset($company)) {
// if the company already exists -> update
$company->fill($data);
if ($company->save()) {
return $company;
}
} else {
//otherwise we create a new one
$data["cluster_id"] = $cluster->id;
return Company::create($data);
}
} else {
return $this->_sendValidationErrorMessage($validator);
}
} else {
return $this->_sendErrorMessage(403, "WriteAccessForbiden", "You can't create things on behalf of another user.");
}
}
示例10: run
public function run()
{
Company::create(['rut' => "9-1", 'adress' => "Dirección", 'city' => "Santiago", 'location' => "San Miguel", 'phone_number' => "5544525", 'fancy_name' => "Jumbo", 'description' => "Comercializado de Productos Jumbo"]);
}
示例11: company
function company($condition = FALSE, $id = FALSE)
{
switch ($condition) {
case 'create':
if ($_POST) {
unset($_POST['send']);
$_POST = array_map('htmlspecialchars', $_POST);
$company = Company::create($_POST);
$companyid = Company::last();
$new_company_reference = $_POST['reference'] + 1;
$company_reference = Setting::first();
$company_reference->update_attributes(array('company_reference' => $new_company_reference));
if (!$company) {
$this->session->set_flashdata('message', 'error:' . $this->lang->line('messages_company_add_error'));
} else {
$this->session->set_flashdata('message', 'success:' . $this->lang->line('messages_company_add_success'));
}
redirect('clients/view/' . $companyid->id);
} else {
$this->view_data['clients'] = Company::find('all', array('conditions' => array('inactive=?', '0')));
$this->view_data['next_reference'] = Company::last();
$this->theme_view = 'modal';
$this->view_data['title'] = $this->lang->line('application_add_new_company');
$this->view_data['form_action'] = 'clients/company/create';
$this->content_view = 'clients/_company';
}
break;
case 'update':
if ($_POST) {
unset($_POST['send']);
$id = $_POST['id'];
if (isset($_POST['view'])) {
$view = $_POST['view'];
unset($_POST['view']);
}
$_POST = array_map('htmlspecialchars', $_POST);
$company = Company::find($id);
$company->update_attributes($_POST);
if (!$company) {
$this->session->set_flashdata('message', 'error:' . $this->lang->line('messages_save_company_error'));
} else {
$this->session->set_flashdata('message', 'success:' . $this->lang->line('messages_save_company_success'));
}
redirect('clients/view/' . $id);
} else {
$this->view_data['company'] = Company::find($id);
$this->theme_view = 'modal';
$this->view_data['title'] = $this->lang->line('application_edit_company');
$this->view_data['form_action'] = 'clients/company/update';
$this->content_view = 'clients/_company';
}
break;
case 'delete':
$company = Company::find($id);
$company->inactive = '1';
$company->save();
foreach ($company->clients as $value) {
$client = Client::find($value->id);
$client->inactive = '1';
$client->save();
}
$this->content_view = 'clients/all';
if (!$company) {
$this->session->set_flashdata('message', 'error:' . $this->lang->line('messages_delete_company_error'));
} else {
$this->session->set_flashdata('message', 'success:' . $this->lang->line('messages_delete_company_success'));
}
redirect('clients');
break;
}
}
示例12: Get_record_file_handle
public function Get_record_file_handle()
{
//<--this function helps to find and return clculating records data
$csvStored_data = "";
$start_date = $this->get_date_period_start();
$end_date = $this->get_date_period_ends();
$month_start = $start_date[1] - 1;
//<--special arrangement for yahoo finance data (0 -> january)
$month_ends = $end_date[1] - 1;
//<--special arrangement for yahoo finance data (0 -> january)
$file = 'http://ichart.yahoo.com/table.csv?s=' . $this->company_symbol . '&a=' . $month_start . '&b=' . $start_date[2] . '&c=' . $start_date[0] . '&d=' . $month_ends . '&e=' . $end_date[2] . '&f=' . $end_date[0] . '&g=' . $this->interval . '&ignore=.csv';
$stored_data = CompanyData::get_last_updated_record($this->company_symbol);
//<-- this function finds the data from database
if ($stored_data) {
if (date("Y-m-d", strtotime($stored_data->updated)) < date("Y-m-d", time()) || $stored_data->accuracy < $this->precision) {
$csvStored_data = csv_to_array($file, ',');
//<----exploring CSV file
if (count($csvStored_data) > 4) {
//<--checks for the genuinity
$company_id = Company::find_company_id_company_symbol($this->company_symbol);
$prediction = CompanyData::where('comp_id_fk', '=', $company_id)->delete();
$company = CompanyData::create(array('comp_id_fk' => $company_id, 'csvdata' => serialize($csvStored_data), 'updated' => date("Y-m-d H:i:s", time()), 'accuracy' => $this->precision));
}
} else {
$csvStored_data = unserialize($stored_data->csvdata);
}
$this->company_description = $stored_data->description;
$this->company_address = $stored_data->address;
} else {
$company = new Company();
$company->company_name = trim($this->company_name);
$this->company_description = get_Company_data($this->company_symbol, 'desci');
get_Company_logo($this->company_symbol);
//<--fuction used to copy image
$company->description = $this->company_description;
$company->company_symbol = trim($this->company_symbol);
$csvStored_data = csv_to_array($file, ',');
//<----exploring CSV file
if (count($csvStored_data) > 4) {
//<--checks for the genuinity
$company = Company::create(array('company_name' => trim($this->company_name), 'company_description' => get_Company_data($this->company_symbol, 'desci'), 'description' => $this->company_description, 'company_symbol' => trim($this->company_symbol)));
if ($company) {
if ($csvStored_data) {
get_Company_logo($this->company_symbol);
//<--fuction used to copy image
}
$CompanyData = CompanyData::create(array('comp_id_fk' => trim($company->id), 'csvdata' => serialize($csvStored_data), 'updated' => date("Y-m-d H:i:s", time()), 'accuracy' => $this->precision));
$predict_data = Prediction::create(array('comp_id_fk' => trim($company->id)));
}
}
}
return !empty($csvStored_data) ? $csvStored_data : false;
}
示例13: create_client
function create_client($id = FALSE)
{
if ($_POST) {
unset($_POST['send']);
$_POST = array_map('htmlspecialchars', $_POST);
$client = Company::create($_POST);
$new_client_reference = $_POST['reference'] + 1;
$client_reference = Setting::first();
$client_reference->update_attributes(array('company_reference' => $new_client_reference));
if (!$client) {
$this->session->set_flashdata('message', 'error:' . $this->lang->line('messages_company_add_error'));
} else {
$this->session->set_flashdata('message', 'success:' . $this->lang->line('messages_company_add_success'));
}
redirect('clients');
} else {
$this->view_data['client'] = Quote::find($id);
$next_reference = Company::last();
$reference = $next_reference->reference + 1;
$this->view_data['client_reference'] = $reference;
$this->theme_view = 'modal';
$this->view_data['title'] = $this->lang->line('application_add_new_company');
$this->view_data['form_action'] = 'quotations/create_client';
$this->content_view = 'quotations/_clients';
}
}
示例14: function
return View::create('companies/add', $vars)->partial('header', 'partials/header')->partial('footer', 'partials/footer');
});
Route::post('admin/companies/add', function () {
$input = Input::get(array('title', 'slug', 'description'));
$validator = new validator($input);
$validator->check('title')->is_max(3, __('companies.title_missing'));
if ($errors = $validator->errors()) {
Input::flash();
Notify::error($errors);
return Response::redirect('admin/companies/add');
}
if (empty($input['slug'])) {
$input['slug'] = $input['title'];
}
$input['slug'] = slug($input['slug']);
$company = Company::create($input);
Extend::process('company', $company->id);
Notify::success(__('companies.created'));
return Response::redirect('admin/companies');
});
Route::get('admin/companies/delete/(:num)', function ($id) {
$total = Company::count();
if ($total == 1) {
Notify::error(__('companies.delete_error'));
return Response::redirect('admin/companies/edit/' . $id);
}
$company = Company::where('id', '<>', $id)->fetch();
Company::find($id)->delete();
Post::where('company', '=', $id)->update(array('company' => $company->id));
Notify::success(__('companies.deleted'));
return Response::redirect('admin/companies');
示例15: createTestCompany
protected static function createTestCompany()
{
self::setTestApiKey();
self::randomizeCompanyName();
return Company::create(self::$test_company);
}