本文整理汇总了PHP中app\Company::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Company::save方法的具体用法?PHP Company::save怎么用?PHP Company::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Company
的用法示例。
在下文中一共展示了Company::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save(Request $request)
{
$input = $request->all();
// $field_name = implode('|',$input['website']['locales']);
$company = new Company();
$company->name = $input['client']['company_name'];
$company->alias = $input['website']['sub_name'];
$company->save();
$user = new User();
$user->name = $input['client']['name'];
$user->email = $input['client']['email'];
$user->password = $input['client']['password'];
$user->ip = '*';
$user->branch_id = 1;
$user->company_id = $company->id;
$user->active = 1;
$user->save();
$user->roles()->attach(Role::find(1)->id);
// $gr_fields = new GrFields;
// $gr_fields->field_name = $field_name;
// $gr_fields->company_id = $company->id;
// $gr_fields->save();
session(['input' => $input]);
return redirect('thanks');
}
示例2: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param StoreDeveloperRequest $validationRequest
* @return \Illuminate\Http\Response
*/
public function store(StoreCompanyRequest $request)
{
$company = new Company($request->all());
$company->save();
Session::flash('message', 'Company created');
return redirect('/company');
}
示例3: 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, ['name' => 'required|unique:companies|max:255']);
$company = new Company();
$company->name = $request->input('name');
$company->description = $request->input('description', "");
$company->save();
return redirect()->route('company.index');
}
示例4: saveCompanyDetails
public static function saveCompanyDetails(Request $request)
{
$rules = self::getRules();
$validator = Validator::make($request->all(), $rules);
if ($validator->fails()) {
return Redirect::to('/system/company')->withErrors($validator)->withInput()->send();
} else {
$companyDetailsContent = CompanyRepository::count();
if ($companyDetailsContent > 0) {
$companyDetails = CompanyRepository::getCompanyDetails();
if ($request->file('company_logo_name')) {
if ($companyDetails->company_logo_name != null) {
CommonTasks::deleteImage($companyDetails->company_logo_name);
}
$storageName = CommonTasks::prepareImage($request->file('company_logo_name'), 200, 200);
$companyDetails->company_logo_name = $storageName;
} else {
if ($request->get('clear_check') == 'checked') {
CommonTasks::deleteImage($companyDetails->company_logo_name);
$companyDetails->company_logo_name = null;
}
}
$companyDetails->company_name = $request->get("company_name");
$companyDetails->company_description = $request->get("company_description");
$companyDetails->company_address = $request->input("company_address") == "" ? null : $request->input("company_address");
$companyDetails->company_telephone = $request->input("company_telephone") == "" ? null : $request->input("company_telephone");
$companyDetails->company_tin_number = $request->input("company_tin_number") == "" ? null : $request->input("company_tin_number");
$companyDetails->company_ssnit_number = $request->input("company_ssnit_number") == "" ? null : $request->input("company_ssnit_number");
$companyDetails->company_email = $request->input("company_email") == "" ? null : $request->input("company_email");
$companyDetails->company_website = $request->input("company_website") == "" ? null : $request->input("company_website");
$companyDetails->push();
Session::flash('message', 'Company Information Saved');
return Redirect::to('/system/company')->send();
} else {
$company = new Company();
$company->company_name = $request->get("company_name");
$company->company_description = $request->get("company_description");
$company->company_address = $request->input("company_address") == "" ? null : $request->input("company_address");
$company->company_telephone = $request->input("company_telephone") == "" ? null : $request->input("company_telephone");
$company->company_tin_number = $request->input("company_tin_number") == "" ? null : $request->input("company_tin_number");
$company->company_ssnit_number = $request->input("company_ssnit_number") == "" ? null : $request->input("company_ssnit_number");
$company->company_email = $request->input("company_email") == "" ? null : $request->input("company_email");
$company->company_website = $request->input("company_website") == "" ? null : $request->input("company_website");
if ($request->file('company_logo_name')) {
$storageName = CommonTasks::prepareImage($request->file('company_logo_name'), 200, 200);
$company->company_logo_name = $storageName;
} else {
$company->company_logo_name = null;
}
$company->save();
Session::flash('message', 'Company Information Saved');
return Redirect::to('/system/company')->send();
}
}
}
示例5: store
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return Response
*/
public function store(Request $request)
{
$this->middleware('isMember');
$a = new Company();
if (!$a->validate(Input::all())) {
return redirect('company/create')->withErrors($a->errors())->withInput();
}
$a->fill(Input::all());
$a->save();
Flash::success('New company is created');
return Redirect::to('company');
}
示例6: store
public function store(Request $request)
{
$this->validate($request, ['name' => 'required|max:255|min:3', 'city' => 'required|max:100', 'post_code' => 'numeric', 'address' => 'required|max:255', 'timezone' => 'required', 'currency' => 'required']);
$company = new Company();
$company->id = uniqid();
$company->name = $request->get('name');
$company->city = $request->get('city');
$company->post_code = $request->get('post_code');
$company->address = $request->get('address');
$company->timezone = $request->get('timezone');
$company->currency_id = $request->get('currency');
$company->save();
return redirect('/companies#')->with(['message' => 'New company added successfully.']);
}
示例7: store
public function store(Request $request)
{
$data = $request->all();
$company = new Company();
$validator = Validator::make($data, ['name' => 'required|max:100', 'email' => 'required|email|unique:companies', 'password' => 'required']);
if ($validator->fails()) {
return response()->json(['message' => 'Validation Failed', 'errors' => $validator->errors()->all()], 422);
}
$company->fill($data);
$password = $request->only('password')["password"];
$company->password = Hash::make($password);
$company->save();
return response()->json($company, 201);
}
示例8: doSignup
public function doSignup()
{
$rules = ['name' => 'required', 'email' => 'required|email|unique:company', 'password' => 'required|confirmed', 'password_confirmation' => 'required'];
$validator = Validator::make(Input::all(), $rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
} else {
$user = new Company();
$user->name = Input::get('name');
$user->email = Input::get('email');
$user->password = md5(Input::get('password'));
$user->save();
$alert['msg'] = 'User has been signed up successfully';
$alert['type'] = 'success';
return Redirect::route('company.signup')->with('alert', $alert);
}
}
示例9: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$input = $request->only(['name', 'rut', 'phone', 'email', 'benefit', 'amount', 'month']);
$count = Company::where('rut', '=', $input['rut'])->count();
if ($count == 0) {
//
$rules = ['name' => 'required', 'rut' => 'required', 'phone' => 'required', 'email' => 'required|email', 'benefit' => 'required|numeric', 'amount' => 'required|numeric', 'month' => 'required|numeric|min:1'];
$validation = \Validator::make($input, $rules);
if ($validation->passes()) {
$company = new Company($input);
$company->save();
return response()->json(["respuesta" => "Guardado"]);
}
$messages = $validation->errors();
return response()->json($messages);
}
return response()->json(["respuesta" => "Ese rut ya esta registrado"]);
}
示例10: store
/**
* Store new account
*
*/
public function store(Request $request)
{
$user = new User();
$user->name = $request->input('name');
$user->username = $request->input('username');
$user->email = $request->input('email');
$pass = $request->input('password');
$user->role = 'Owner';
if (!empty($pass)) {
$user->password = bcrypt($pass);
}
$user->save();
// Create Company
$company = new Company();
$company->name = $request->input('company_name');
$company->email = $request->input('company_email');
$company->address1 = $request->input('address1');
$company->address2 = $request->input('address2');
$company->city = $request->input('city');
$company->postcode = $request->input('postcode');
$company->url = strtolower(str_replace(' ', '', $request->input('company_name')));
$company->save();
$user->company_id = $company->id;
$user->update();
$company->user_id = $user->id;
$company->update();
$settings = new Settings();
$settings->application_id = 1;
$settings->references_id = 0;
$settings->company_id = $company->id;
$settings->save();
$refs = new ReferenceFields();
$refs->settings_id = $settings->id;
$refs->company_id = $company->id;
$refs->save();
$options = new Settings();
$options->references_id = 1;
$options->application_id = 0;
$options->company_id = $company->id;
$options->save();
flash()->success('Success', 'Account successfully created');
return back();
}
示例11: companies
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function companies()
{
$dummyCompanies = DummyCompany::all();
$diccionario = [];
foreach ($dummyCompanies as $dummyCompany) {
$dataCompany = ['name' => $dummyCompany->name, 'rut' => $dummyCompany->rut, 'phone' => $dummyCompany->phone, 'email' => $dummyCompany->email, 'benefit' => 0, 'amount' => 0, 'month' => 1];
$company = new Company($dataCompany);
$company->save();
$diccionario[$dummyCompany->id] = $company->id;
}
$dummyPatients = dummyPatient::all();
foreach ($dummyPatients as $dummyPatient) {
if (!isset($diccionario[$dummyPatient->company_id])) {
$diccionario[$dummyPatient->company_id] = 1;
}
$dataPatient = ['firstname' => $dummyPatient->first_name, 'lastname' => $dummyPatient->last_name, 'address' => $dummyPatient->address, 'rut' => $dummyPatient->rut, 'phone' => $dummyPatient->phone, 'email' => $dummyPatient->email, 'type' => "Titular", 'company_id' => $diccionario[$dummyPatient->company_id]];
$patient = new Patient($dataPatient);
$patient->save();
}
echo ":S";
}
示例12: postChooseType
/**
* 添加代帐公司
* @return mixed
* @param Request $request
* @author AndyLee <root@lostman.org>
*/
public function postChooseType(Request $request)
{
//TODO 是否限制用户创建的代帐公司个数
$input = $request->only('type', 'company', 'mobile');
$rules = ['type' => 'required|min:0|max:1|integer', 'company' => 'required', 'mobile' => 'required|Regex:/^1[0-9]{10}$/'];
$v = Validator::make($input, $rules);
if ($v->fails()) {
$request->session()->flash('error', $v->messages()->first());
return redirect()->to('/');
}
$company = new Company();
/**
* 0为个人版本 1为收费
*/
if ($input['type'] == 0) {
$company->registion_type = 'personal';
} else {
$company->registion_type = 'company';
}
$company->package_id = $input['type'];
$company->name = $input['company'];
$company->status = 0;
//0为正常运行状态
$company->mobile = $input['mobile'];
$company->main_user = Auth::user()->id;
$company->save();
/**
* 绑定代帐公司与操作员
*/
$nexus = new UserNexus();
$nexus->operator_id = Auth::user()->id;
$nexus->user_id = $company->id;
$nexus->level = 1;
$nexus->save();
$request->session()->flash('success', '信息完善成功,欢迎使用代帐通,请选择登录的代帐账户');
return redirect()->to('/');
}
示例13: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
$validator = Validator::make($request->all(), ['name' => 'required|min:5|unique:companies', 'email' => 'required|min:5|unique:companies', 'phone' => 'required|min:5|unique:companies']);
if ($validator->fails()) {
if ($request->ajax()) {
return response()->json($validator->messages());
} else {
return \Redirect::back()->withErrors($validator)->withInput();
}
}
$all_request = $request->all();
array_forget($all_request, "_token");
$company = new Company();
foreach ($all_request as $key => $value) {
$company->{$key} = $value;
}
$company->save();
$companies = Company::all();
if ($request->ajax()) {
return response()->json("record saved successfully");
}
return View("company.index", ['companies' => $companies, 'title' => 'Companies']);
}
示例14: optAdd
public function optAdd()
{
$company = new Company();
$company->name = "Demo company 1";
$company->description = "Descripción company 1";
$company->user_id = 1;
$company->save();
$company = new Company();
$company->name = "Demo company 2";
$company->description = "Descripción company 2";
$company->user_id = 1;
$company->save();
$userName = '';
return view('company.index', ['userName' => $userName]);
}
示例15: storecompanybyadmin
/**
* save company data by admin
* @param integer $id
* @return Response
*/
public function storecompanybyadmin()
{
$v = Validator::make(Request::all(), ['name' => 'required|max:255', 'email' => 'required|email|max:255|unique:users', 'password' => 'required|confirmed|min:6']);
if ($v->fails()) {
return redirect()->back()->withErrors($v->errors())->withInput();
} else {
$user = new User();
$user->name = Request::get('name');
$user->email = Request::get('email');
$user->type = 'companyuuuuuu';
$user->password = bcrypt(Request::get('password'));
$user->save();
$company = new Company();
//$userId=Auth::user()->id;
$company->user_id = $user->id;
$company->country_id = Request::get('country');
$company->city = Request::get('city');
$company->logo = Request::get('company');
$company->address = Request::get('address');
$company->desc = Request::get('desc');
$company->phone = Request::get('phone');
$company->anotherphone = Request::get('anotherphone');
$company->fax = Request::get('fax');
$company->facebook = Request::get('facebook');
$company->twitter = Request::get('twitter');
$company->linkedIn = Request::get('linkedIn');
$company->website = Request::get('website');
$company->save();
// Mail::send('emails.welcome', $data, function($message) use ($data)
// {
// $message->from('yoyo80884@gmail.com', "Wavexpo");
// $message->subject("Welcome to Wavexpo Please visit our website to continu you information");
// $message->to($data['email']);
// });
// File Storage
// $file = new File;
// $file->name=Request::get('filename');
// $file->desc=Request::get('filedesc');
// $file->type=Request::get('filetype');
// if (Request::hasFile('file')) {
// $destination='files/';
// $filename=str_random(6)."_".Request::file('file')->getClientOriginalName();
// Request::file('file')->move($destination,$filename);
// $file->file=$filename;
// }else{
// $file->file=Request::get('file');
// }
// $file->save();
// $userfile= new CompanyFile;
// $userfile->company_id=$company->id;
// $userfile->file_id=$file->id;
// $userfile->save();
//return redirect('users');
return redirect('companies');
}
}