本文整理汇总了PHP中app\Client::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::save方法的具体用法?PHP Client::save怎么用?PHP Client::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Client
的用法示例。
在下文中一共展示了Client::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
public function store()
{
// validate
// read more on validation at http://laravel.com/docs/validation
$rules = array('full_name' => 'required', 'name' => 'required', 'inn' => 'required', 'kpp' => 'required|size:9', 'ogrn' => 'required|unique:clients|size:13');
$validator = Validator::make(Input::all(), $rules);
// process the login
if ($validator->fails()) {
return redirect()->back()->with('danger', 'Данные клиента введены неверно')->withInput();
} else {
if (count(Client::where('inn', '=', Input::get('inn'))->get()) > 0) {
return redirect()->back()->with('danger', 'Клиент с данным ИНН уже имеется в базе')->withInput();
} else {
var_dump($this->is_valid_inn((int) Input::get('inn')));
if ($this->is_valid_inn((int) Input::get('inn'))) {
//Проверка инн
$client = new Client();
$client->full_name = Input::get('full_name');
$client->name = Input::get('name');
$client->inn = Input::get('inn');
$client->kpp = Input::get('kpp');
$client->ogrn = Input::get('ogrn');
$client->save();
// redirect
//*Request::flashOnly('message', 'Клиент добавлен');*/
Session::flash('success', 'Клиент добавлен');
return Redirect::to('client/' . $client->id . '/agreement');
} else {
return redirect()->back()->with('danger', 'ИНН введен не верно')->withInput();
}
}
}
}
示例2: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(ClientRequest $request)
{
$Client = new Client($request->all());
$Client->save();
Flash::success('Se ha creado a ' . $Client->nombre . ', como cliente.');
return redirect()->route('clientes.index');
}
示例3: create
/**
* Handle creation of new bill.
*
* @param CreateBillRequest $request
* @return array
*/
public function create(CreateBillRequest $request)
{
// Save request data
$clientName = $request->get('client');
$useCurrentCampaign = $request->get('use_current_campaign');
$campaignYear = $request->get('campaign_year');
$campaignNumber = $request->get('campaign_number');
$client = DB::table('clients')->where('name', $clientName)->where('user_id', Auth::user()->id)->first();
// Create new client if not exists
if (!$client) {
$client = new Client();
$client->user_id = Auth::user()->id;
$client->name = $clientName;
$client->save();
}
// Create new bill
$bill = new Bill();
$bill->client_id = $client->id;
$bill->user_id = Auth::user()->id;
$campaign = Campaigns::current();
// Check if current campaign should be used
if (!$useCurrentCampaign) {
$campaign = Campaign::where('year', $campaignYear)->where('number', $campaignNumber)->first();
}
$bill->campaign_id = $campaign->id;
$bill->campaign_order = Campaigns::autoDetermineOrderNumber($campaign, $client->id);
$bill->save();
event(new UserCreatedNewBill(Auth::user()->id, $bill->id));
// Return response
$response = new AjaxResponse();
$response->setSuccessMessage(trans('bills.bill_created'));
return response($response->get());
}
示例4: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//
$client = new Client();
$client->name = $request->name;
$client->save();
}
示例5: submitOTP
public function submitOTP(Request $request)
{
//get mobile number from user input
$mobileNum = $request->input('mobile');
//get user type from user input
$userType = $request->input('userType');
//set user email
$userEmail = 'new_user@email.com';
//set country code
$countryCode = 61;
//initial authentication API
// $authy_api = new AuthyApi(config('services.authy.key'));
$authy_api = new AuthyApi(config('services.authy.key'), 'http://sandbox-api.authy.com');
//sandbox
//register a user through email, cellphone, country_code
$user = $authy_api->registerUser($userEmail, $mobileNum, $countryCode);
//generate authentication token and send it to usser
$sms = $authy_api->requestSms($user->id(), array("force" => "true"));
if ($sms->ok()) {
//check user exist or not
$results = Client::where('mobile', $mobileNum)->first();
//if user does not exist, register of him
if (empty($results)) {
$newUser = new Client();
$newUser->mobile = $mobileNum;
$newUser->save();
}
return view('auth.otp')->with('userid', $user->id())->with('mobileNum', $mobileNum)->with('userType', $userType);
} else {
//session()->put('message','incorrect mobile number');
return redirect('login')->with('message', 'Please input correct mobile number');
}
}
示例6: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(ClientRequest $request)
{
//
$user = new User();
$user->email = $request->email;
$user->nama = $request->name_pt;
$user->password = Hash::make($request->password);
$user->type = "client";
$user->status = "active";
$user->save();
$client = new Client();
$client->nama_pt = $request->name_pt;
$client->pic = $request->pic;
$client->alamat = $request->address;
$client->no_telepon = $request->phone;
$client->id_user = $user->id_user;
$client->lat = $request->lat;
$client->long = $request->long;
$client->save();
foreach ($request->support as $item) {
$cs = new ClientSupport();
$cs->id_client = $client->id_client;
$cs->id_support = $item;
$cs->save();
}
Session::flash("success", "Success add client");
return redirect()->route('client');
}
示例7: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$client = new Client();
$client->name = Str::title(Input::get('name'));
$client->hours = $client->amount = 0;
$client->save();
return redirect()->action('ClientController@show', $client->id);
}
示例8: store
/**
* Store a newly created resource in storage.
*
* @param StoreAddClientPostRequest $request
* @return Response
*/
public function store(StoreaddClientPostRequest $request)
{
$person = new Client(array('name' => $request->name, 'user_id' => Auth::user()->id, 'nationality' => $request->nationality, 'email' => $request->email, 'idNumber' => $request->idNumber, 'phoneNo' => $request->phoneNo, 'role' => 'owner'));
$person->save();
Session::put('ClientInsertedId', $person->id);
Session::put('AddRole', 'owner');
Session::flash('flash_message', 'Owner successfully added! Need to add the Address');
return redirect('bankDetail/create');
}
示例9: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$client = new Client($request->input());
$client->public_id = str_random(8);
$client->user_id = Auth::user()->id;
$client->status = "active";
$client->save();
return redirect('clients/' . $client->id);
}
示例10: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
if (\Input::get('id')) {
$client = Client::find(\Input::get('id'));
$client->fill(\Input::all());
} else {
$client = new Client(\Input::all());
}
if ($client->save()) {
return $client;
}
}
示例11: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(User $user, Request $request)
{
$data = $request->only('name', 'email', 'address', 'phone');
$client = new Client();
$client->user_id = $user->id;
$client->name = $data['name'];
$client->email = $data['email'];
$client->phone = $data['phone'];
$client->address = $data['address'];
$client->save();
return response(['msg' => 'client was added'], 201);
}
示例12: testClientSave
public function testClientSave()
{
$client = new Client();
$client->name = 'Idea7';
$client->country = 'IN';
$client->status = 'active';
if (!$client->save()) {
$errors = $client->getErrors()->all();
echo 'Client Insert failed' . print_r($errors);
$this->assertTrue(false);
} else {
$this->assertTrue(true);
}
}
示例13: postClient
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function postClient(Request $request)
{
$this->validate($request, ['name' => 'required', 'image' => 'required']);
$client = new Client();
$client->name = $request->name;
$imageName = time() . '.' . $request->image->getClientOriginalExtension();
$imagePath = public_path('/uploads/' . $imageName);
$imageResize = \Image::make(\Input::file('image'))->resize(175, 130)->save($imagePath);
$client->image = $imageName;
$client->link = $request->link;
$client->save();
Session::flash('message', 'Successfully Stored your Data!');
return redirect()->back();
}
示例14: postRegistrar
public function postRegistrar(Request $request)
{
$validator = Validator::make($request->all(), ['name' => 'required|max:70', 'ruc' => 'required|numeric|digits:11', 'phone' => 'min:6|numeric', 'email' => 'email']);
if ($validator->fails()) {
return redirect('clientes')->withInput()->withErrors($validator);
}
$client = new Client();
$client->name = $request->name;
$client->ruc = $request->ruc;
$client->address = $request->address;
$client->phone = $request->phone;
$client->email = $request->email;
$client->save();
return redirect('clientes');
}
示例15: 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', 'country' => 'required']);
if ($validator->fails()) {
return Redirect::to('clients/create')->withErrors($validator)->withInput();
}
// store
$client = new Client();
$client->name = $request->input('name');
$client->country = $request->input('country');
$client->status = 'active';
$client->save();
Session::flash('message', 'Client Successfully created!');
return redirect('clients');
}