本文整理汇总了PHP中app\Company::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Company::create方法的具体用法?PHP Company::create怎么用?PHP Company::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Company
的用法示例。
在下文中一共展示了Company::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$faker = Faker::create();
foreach (range(1, 30) as $index) {
\App\Company::create(['name' => $faker->company()]);
}
}
示例2: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
$input = \Input::all();
Company::create($input);
return \Redirect::back()->with('message', 'İşletme Başarıyla Kaydedildi');
}
示例3: run
public function run()
{
$faker = Faker\Factory::create();
for ($i = 0; $i < 20; $i++) {
\App\Company::create(['title' => $faker->unique()->company, 'address' => $faker->streetAddress, 'phone' => $faker->phoneNumber]);
}
}
示例4: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$this->validate($request, $this->rules);
$input = Input::all();
$input['user_id'] = Auth::User()->id;
Company::create($input);
return Redirect::route('company.index')->with('Company created.');
}
示例5: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(Requests\UpdateAndSaveCompany $request, Company $company)
{
$company->create($request->all());
\Session::flash('message', 'You have successfully Created ' . $company->name);
$companies = Company::orderBy('name')->paginate(15);
$keyword = '';
return view('company.list', compact('companies', 'keyword'));
}
示例6: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
// unguard()メソッドは、EloquentのマスアサインメントをOFFにします。
Model::unguard();
//
Company::create(['id' => 1, 'company_id' => 1, 'name' => '株式会社VApps', 'name_kana' => 'ぶいあっぷす']);
Company::create(['id' => 2, 'company_id' => 2, 'name' => '株式会社PApps', 'name_kana' => 'ぴーあっぷす']);
Company::create(['id' => 3, 'company_id' => 3, 'name' => '株式会社AApps', 'name_kana' => 'あーあっぷす']);
}
示例7: run
public function run()
{
DB::table('companies')->truncate();
Model::unguard();
Company::create(['title' => 'Sika', 'short_title' => 'sika', 'file_main' => '1.jpg', 'file_logo' => '1.png']);
Company::create(['title' => 'SFS intec', 'short_title' => 'sfs', 'file_main' => '2.jpg', 'file_logo' => '2.png']);
Company::create(['title' => 'Праймер', 'short_title' => 'primer', 'file_main' => '3.jpg', 'file_logo' => '3.png']);
Model::reguard();
}
示例8: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$faker = Faker::create();
for ($i = 0; $i < 1; $i++) {
$companyName = str_replace('-', ' ', $faker->unique()->company);
$userName = str_replace([' ', ','], '', $companyName);
$domain = $userName . $faker->randomElement(['.com', '.net', '.org']);
Company::create(['status' => $faker->randomElement(['active', 'inactive']), 'name' => $companyName, 'website_name' => $companyName, 'slogan' => $faker->catchPhrase, 'logo' => '/img/pt-default/' . $faker->unique()->numberBetween(1, 330) . '.jpg', 'theme' => '', 'phone_number' => $faker->phoneNumber, 'cell_phone' => $faker->phoneNumber, 'address' => $faker->streetAddress, 'state' => $faker->state, 'city' => $faker->city, 'zip_code' => $faker->postcode, 'facebook' => $userName, 'google_plus' => $userName, 'facebook_app_id' => $faker->md5, 'twitter' => $userName, 'email' => 'info@' . $domain, 'contact_email' => 'contact@' . $domain, 'sales_email' => 'sales@' . $domain, 'support_email' => 'support@' . $domain, 'website' => 'http://' . $domain, 'description' => $faker->text(200), 'keywords' => implode(',', $faker->words(20)), 'about_us' => $faker->text(1200), 'refund_policy' => trans('law.refund'), 'privacy_policy' => trans('law.privacy'), 'terms_of_service' => trans('law.terms'), 'google_maps_key_api' => 'AIzaSyCutQnEgrqX8W2X-nBCYB7-CbsTC-LlRMw']);
}
}
示例9: create
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return User
*/
protected function create(array $data)
{
$newUser = ['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password']), 'user_type' => $data['user_type'], 'phone' => $data['phone']];
$user = User::create($newUser);
// SE É EMPRESA CRIAR TAMBÉM UM REGISTRO NA TABELA COMPANY
if ($data['user_type'] == 'COMPANY') {
Company::create(['id_user' => $user->id_user, 'cnpj' => ${$data}['cnpj']]);
}
return $user;
}
示例10: store
public function store()
{
$input = \Input::all();
$input['company']['user_id'] = \Auth::user()->id;
$v = \Validator::make($input['company'], \App\Company::$createRules);
if ($v->fails()) {
return \Redirect::route('companies.create')->withErrors($v->errors())->withInput();
}
$company = \App\Company::create($input['company']);
return \Redirect::route('companies.show', ['company' => $company]);
}
示例11: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$friendly_url = $this->setFriendlyUrl($request->input('name'));
// if has file
if ($request->hasFile('image')) {
$image_name = $this->uploadImage($request->file('image'), 'companies', $friendly_url);
} else {
$image_name = "none.jpg";
}
Company::create(['name' => $request->input('name'), 'friendly_url' => $friendly_url, 'image' => $image_name, 'description' => $request->input('description'), 'phone' => $request->input('phone'), 'web' => $request->input('web'), 'email' => $request->input('email'), 'status' => $request->input('status')]);
Session::flash('message', 'Compañía agregada con éxito');
return redirect('companies');
}
示例12: saveData
private static function saveData($data)
{
// find company by business_id
$company = Company::where('business_id', $data->businessId)->first();
$company_data = ['business_id' => $data->businessId, 'name' => $data->name, 'company_form' => $data->companyForm, 'registration_date' => $data->registrationDate];
if (is_null($company)) {
// if company not found -> create
$company = Company::create($company_data);
$addedCompanies[] = $company->businessId;
} else {
// if compnay exists -> update
$company->update($company_data);
}
return $addedCompanies;
}
示例13: postRegisterCompany
public function postRegisterCompany(Request $request)
{
$validator = Validator::make($request->except("__token"), ["name" => "required", "email" => "required|email", "tin" => "required", "vrn" => "required", "box" => "required", "address" => "required", "phone" => "required", "logo" => "required|image", "password" => "required|confirmed", "password_confirmation" => "required"]);
if ($validator->passes()) {
$data = $request->all();
//registering the company/adding to db
$company = Company::create(["name" => $data['name'], "tin" => $data['tin'], "box" => $data['box'], "address" => $data['address'], "phone" => $data['phone'], "logo" => $data['logo'], "vrn" => $data['vrn'], "email" => $data['email'], "status" => "pending"]);
$user = User::create(["email" => $data['email'], "password" => Hash::make($data["password"]), "name" => $data["name"], "company_id" => $company->id]);
$role = Role::find(4);
$user->attachRole($role);
$log = Auth::login($user);
if ($log) {
return Redirect::to("/")->with("success", "You are Now Registered and Logged In! \n please wait for Confirmation Email before you can access full system");
}
} else {
return Redirect::back()->withErrors($validator)->withInput();
}
}
示例14: postAdd
public function postAdd(Request $request)
{
try {
$this->validate($request, ['cif' => 'required', 'name' => 'required']);
$input = $request->all();
$company = Company::create($input);
$company->save();
if ($request->clients) {
$company->clients()->sync($request->clients);
}
if ($request->providers) {
$company->providers()->sync($request->providers);
}
Session::flash('ok_message', 'Company successfully added!');
return redirect()->route('admin.companies.index');
} catch (\Exception $e) {
Session::flash('error_message', 'Error adding company');
return redirect()->back();
}
}
示例15: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(Requests\UpdateAndSaveCompany $request, Company $company)
{
$request->offsetSet('created_by', Auth::user()->id);
$request->offsetSet('updated_by', Auth::user()->id);
$request->offsetSet('status', 'ACTIVE');
$company->create($request->all());
$company = DB::table('companies')->where('name', $request->name)->first();
$password = $request->password;
$user = new User();
$request->offsetSet('password', bcrypt($request->password));
$request->offsetSet('created_by', Auth::user()->id);
$request->offsetSet('updated_by', Auth::user()->id);
$request->offsetSet('status', "NEW");
$request->offsetSet('role_id', "4");
$request->offsetSet('manager_id', 0);
$request->offsetSet('company_id', $company->id);
$user->create($request->all());
$user = DB::table('users')->where('email', $request->email)->first();
$goal = parent::assembleGoalSetting();
$goal->user_id = $user->id;
$goal->created_by = Auth::user()->id;
$goal->updated_by = Auth::user()->id;
$goal->save();
$userPassword = new UserPassword();
$userPassword->user_id = $user->id;
$userPassword->crypt_password = \Crypt::encrypt($password);
$userPassword->updated_at = new \DateTime();
$userPassword->created_at = new \DateTime();
$userPassword->save();
$contactEmail = $user->email;
$contactName = $user->first_name . ' ' . $user->last_name;
Mail::send('emails.hello', array('first_name' => $user->first_name, 'user_name' => $user->email, 'password' => $password), function ($message) use($contactEmail, $contactName) {
$message->from('no-reply@salesperformanceindicator.com', 'Sales Performance Indicator');
$message->to($contactEmail, $contactName)->subject('Welcome to Sales Performance Indicator!');
});
\Session::flash('message', 'You have successfully Created ' . $company->name);
$companies = Company::orderBy('name')->paginate(15);
$keyword = '';
return view('company.list', compact('companies', 'keyword'));
}