本文整理汇总了PHP中Cliente::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Cliente::save方法的具体用法?PHP Cliente::save怎么用?PHP Cliente::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cliente
的用法示例。
在下文中一共展示了Cliente::save方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveCliente
public function saveCliente()
{
$this->load->model(array('Cliente'));
header("Content-type: application/json");
$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
$cliente = new Cliente();
if (isset($request->id)) {
$cliente->load($request->id);
}
$cliente->regimen = $request->regimen->id;
$cliente->nombre = $request->nombre;
$cliente->apellidoMaterno = isset($request->apellidoMaterno) ? $request->apellidoMaterno : "";
$cliente->apellidoPaterno = isset($request->apellidoPaterno) ? $request->apellidoPaterno : "";
$cliente->rfc = isset($request->rfc) ? $request->rfc : "";
$cliente->telefono = isset($request->telefono) ? $request->telefono : "";
$cliente->correo = isset($request->correo) ? $request->correo : "";
$cliente->calle = isset($request->calle) ? $request->calle : "";
$cliente->numero = isset($request->numero) ? $request->numero : "";
$cliente->colonia = isset($request->colonia) ? $request->colonia : "";
$cliente->municipio = isset($request->municipio) ? $request->municipio : "";
$cliente->estado = isset($request->estado) ? $request->estado : "";
$cliente->cp = isset($request->cp) ? $request->cp : "";
if ($cliente->save()) {
echo json_encode(array("success" => true));
} else {
echo json_encode(array("success" => true));
}
}
示例2: doSave
/**
* Performs the work of inserting or updating the row in the database.
*
* If the object is new, it inserts it; otherwise an update is performed.
* All related objects are also updated in this method.
*
* @param PropelPDO $con
* @return int The number of rows affected by this insert/update and any referring fk objects' save() operations.
* @throws PropelException
* @see save()
*/
protected function doSave(PropelPDO $con)
{
$affectedRows = 0;
// initialize var to track total num of affected rows
if (!$this->alreadyInSave) {
$this->alreadyInSave = true;
// We call the save method on the following object(s) if they
// were passed to this object by their corresponding set
// method. This object relates to these object(s) by a
// foreign key reference.
if ($this->aCliente !== null) {
if ($this->aCliente->isModified() || $this->aCliente->isNew()) {
$affectedRows += $this->aCliente->save($con);
}
$this->setCliente($this->aCliente);
}
if ($this->isNew() || $this->isModified()) {
// persist changes
if ($this->isNew()) {
$this->doInsert($con);
} else {
$this->doUpdate($con);
}
$affectedRows += 1;
$this->resetModified();
}
$this->alreadyInSave = false;
}
return $affectedRows;
}
示例3: actionCreateClient
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreateClient()
{
$hU = new HttpUtils();
if ($hU->isAjaxRequest() == false) {
Response::error("not allowed ;)");
}
if (isset($_POST["clientName"]) == false || isset($_POST["clientEmail"]) == false) {
Response::ok(CJSON::encode(array("resultado" => Constants::RESULTADO_OPERACION_FALLA, "detalle" => "Faltan parámetros obligatorios")));
}
$cl = Cliente::model()->findAll("email=:email", array(':email' => $_POST["clientEmail"]));
if (sizeof($cl) > 0) {
Response::ok(CJSON::encode(array("resultado" => Constants::RESULTADO_OPERACION_FALLA, "detalle" => "Cliente {$_POST["clientEmail"]} ya registrado en el sistema")));
}
$cl = new Cliente();
$cl->surname = "";
$cl->comments = "";
$cl->streetaddress = "";
$cl->name = $_POST["clientName"];
$cl->email = $_POST["clientEmail"];
if ($cl->save()) {
Response::ok(CJSON::encode(array("resultado" => Constants::RESULTADO_OPERACION_EXITO, "detalle" => "Cliente {$cl->email} registrado con éxito")));
} else {
Response::ok(CJSON::encode(array("resultado" => Constants::RESULTADO_OPERACION_FALLA, "detalle" => "Error registrando cliente {$cl->email} en el sistema")));
}
}
示例4: store
/**
* Store a newly created resource in storage.
*
* @param Request $request
* @return Response
*/
public function store()
{
$Cliente = new Cliente();
$Cliente->nit = Input::get('nit');
$Cliente->nombre = Input::get('nombre');
$Cliente->direccion = Input::get('direccion');
$Cliente->telefono = Input::get('telefono');
$Cliente->celular = Input::get('celular');
$Cliente->correo = Input::get('correo');
$Cliente->dias_plazo_pago = Input::get('dias_plazo_pago');
$Cliente->estado = Input::get('estado');
$Cliente->pais_id = Input::get('pais_id');
$Cliente->departamento_id = Input::get('departamento_id');
$Cliente->ciudad_id = Input::get('ciudad_id');
$validar = Validator::make(Input::all(), $this->reglas);
if ($validar->fails()) {
$return['ok'] = false;
$return['msg'] = $validar->messages();
return $return;
} else {
if ($Cliente->save()) {
$return['ok'] = true;
$return['msg'] = 'El cliente ha sido guardado';
return $return;
} else {
$return['ok'] = false;
$return['msg'] = 'No se pudo crear el registro';
return $return;
}
}
}
示例5: post_nuevo
public function post_nuevo()
{
$inputs = Input::all();
$reglas = array('nombres' => 'required|min:4', 'apellido' => 'required', 'email' => 'email|unique:clients,email', 'localidad' => 'required');
$mensajes = array('required' => 'Campo Obligatorio');
$validar = Validator::make($inputs, $reglas);
if ($validar->fails()) {
Input::flash();
return Redirect::back()->withInput()->withErrors($validar);
} else {
$cliente = new Cliente();
$cliente->nombres = Input::get('nombres');
$cliente->apellido = Input::get('apellido');
$cliente->tipo_doc = Input::get('tipo_doc');
$cliente->documento = Input::get('documento');
$cliente->email = Input::get('email');
$cliente->calle = Input::get('calle');
$cliente->num = Input::get('num');
$cliente->piso = Input::get('piso');
$cliente->localidad = Input::get('localidad');
$cliente->telefono = Input::get('telefono');
$cliente->celular = Input::get('celular');
$cliente->save();
return Redirect::to('lista_clientes')->with('error', 'El Cliente ha sido registrado con Éxito')->withInput();
}
}
示例6: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$pelicula = new Cliente();
$pelicula->nombre = Request::get('nombre');
$pelicula->apellido = Request::get('apellido');
$pelicula->correo = Request::get('correo');
$pelicula->nombreUsuario = Request::get('nombreUsuario');
$pelicula->save();
return Response::json(array('error' => false, 'peliculas' => $pelicula->toArray()), 200);
}
示例7: createCliente
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
private function createCliente($cliente)
{
$usuario = $this->crearUsuarioPasajero($cliente['identificacion']);
$cliente = new Cliente();
$cliente->identificacion = $cliente['identificacion'];
$cliente->nombres = $cliente['nombres'];
$cliente->telefono = $cliente['telefono'];
$cliente->direccion = $cliente['direccion'];
$cliente->usuario_id = $cliente->id;
return array('cliente' => $cliente->save(), 'usuario' => $usuario);
}
示例8: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$this->pageTitle = Yii::app()->name . ' - Cadastro de clientes';
$model = new Cliente();
if (isset($_POST['Cliente'])) {
$model->attributes = $_POST['Cliente'];
$model->data_cadastro = date('d/m/Y H:i:s');
if ($model->save()) {
$this->redirect(array('clienteCarro/create', 'clienteId' => $model->id));
}
}
$this->render('create', array('model' => $model));
}
示例9: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Cliente();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Cliente'])) {
$model->attributes = $_POST['Cliente'];
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->id));
}
}
$this->render('create', array('model' => $model));
}
示例10: store
public function store()
{
$data = Input::all();
$cliente = new Cliente();
$cliente->fill($data['cliente']);
if ($data['cliente']['persona'] == 'j') {
$representante = new Cliente();
$representante->fill($data['representante']);
$representante->save();
$representante->representados()->save($cliente);
}
$cliente->save();
return Redirect::route('clientes.index');
}
示例11: run
public function run()
{
// going 'Faker' :) on the polls table.
$faker = Faker::create();
for ($i = 1; $i <= 100; $i++) {
$cliente = new Cliente();
$cliente->direccion = $faker->address;
$cliente->nombre = $faker->name;
$cliente->email = $faker->email;
$cliente->telefono = $faker->phoneNumber;
$cliente->farmacia_id = $faker->numberBetween(1, 5);
$cliente->save();
}
}
示例12: RegistrarCliente
public function RegistrarCliente($nombres, $doc_ident, $atencion_a, $direccion, $telefono, $correo, $referencia)
{
$resultado = array('valor' => 1, 'message' => 'Servicio Registrado correctamente.');
$cliente = new Cliente();
$cliente->nombres = $nombres;
$cliente->doc_ident = $doc_ident;
$cliente->atencion_a = $atencion_a;
$cliente->direccion = $direccion;
$cliente->telefono = $telefono;
$cliente->correo = $correo;
$cliente->referencia = $referencia;
if (!$cliente->save()) {
$resultado = array('valor' => 0, 'message' => 'No hemos podido Registrar el servicio, intentelo nuevamente');
}
return $resultado;
}
示例13: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Cliente();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
$id = $model->RUTCLIENTE;
$persona2 = Yii::app()->db->createCommand("SELECT count(*) AS total FROM cliente WHERE RUTCLIENTE = '" . $id . "'")->queryRow();
$cant = $persona2["total"];
if (isset($_POST['Cliente'])) {
$model->attributes = $_POST['Cliente'];
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->RUTCLIENTE));
}
}
$this->render('addCliente', array('model' => $model));
}
示例14: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$nombre = Input::get('nombre');
$email = Input::get('email');
$telefonoR = Input::get('telefono_resi');
$telefonoM = Input::get('telefono_movil');
$direccion = Input::get('direccion');
$cliente = new Cliente();
$cliente->nombre = $nombre;
$cliente->email = $email;
$cliente->telefono_resi = $telefonoR;
$cliente->telefono_movil = $telefonoM;
$cliente->direccion_fisica = $direccion;
$cliente->save();
Session::flash('message', 'Registro guardado satisfactoriamente!');
return Redirect::to('clientes');
}
示例15: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate()
{
$model = new Cliente();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Cliente'])) {
$model->attributes = $_POST['Cliente'];
if (!Cliente::model()->find('RUTCLIENTE=:RUT', array(':RUT' => $model->RUTCLIENTE))) {
if ($model->save()) {
$this->redirect('?r=propiedad/index');
}
} else {
$this->render('addCliente', array('model' => $model));
}
} else {
$this->render('addCliente', array('model' => $model));
}
}