本文整理汇总了PHP中Cliente::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Cliente::select方法的具体用法?PHP Cliente::select怎么用?PHP Cliente::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cliente
的用法示例。
在下文中一共展示了Cliente::select方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
function login(Request $request, Response $response)
{
$response = $response->withHeader('Content-type', 'application/json');
$data = json_decode($request->getBody(), true);
$cont = 0;
$std = 0;
$roles = array();
$dataCliente = Cliente::select("email", "nombres", "apellidos")->where('email', '=', $data['usuario'])->where('pass', '=', $data['pass'])->first();
if ($dataCliente != null) {
$cont++;
array_push($roles, "cliente");
}
$dataEmpresa = Empresa::select("email", "nombre", "foto")->where('email', '=', $data['usuario'])->where('pass', '=', $data['pass'])->first();
if ($dataEmpresa != null) {
$cont++;
array_push($roles, "empresa");
}
$dataUsuario = Usuario::select("id", "nombres", "apellidos", "idSucursal", "idCategoria")->where('id', '=', $data['usuario'])->where('pass', '=', $data['pass'])->first();
if ($dataUsuario != null) {
$cont++;
array_push($roles, "usuario");
}
if ($cont > 0) {
$response = $response->withStatus(200);
$std = 1;
} else {
$response = $response->withStatus(404);
}
$response->getBody()->write(json_encode(array("std" => $std, "roles" => $roles)));
return $response;
}
示例2: general
public function general()
{
$totalClientes = Cliente::select(DB::raw("count(*) as total"))->first();
$totalClientesDeudores = Cliente::select(DB::raw("count(*) as total"))->where('saldo', '>', 0)->first();
$totalClientesDeudoresPasados = Cliente::select(DB::raw("count(*) as total"))->where('saldo', '>', 1000)->where('saldo', '>', 0)->first();
$totalDeuda = Cliente::select(DB::raw('sum(saldo) as total'))->where('saldo', '>', 0)->first();
$data['totalClientes'] = $totalClientes->total;
$data['totalClientesDeudores'] = $totalClientesDeudores->total;
$data['totalClientesDeudoresPasados'] = $totalClientesDeudoresPasados->total;
$data['totalDeuda'] = $totalDeuda->total;
return View::make('reportes.general', compact('data'));
}
示例3: exportarEmail
public function exportarEmail()
{
Excel::create('Clientes' . date('Ymd'), function ($excel) {
$excel->sheet('Clientes', function ($sheet) {
$clientes = Cliente::select('email')->distinct()->get();
$datos = array(array('Email'));
foreach ($clientes as $cliente) {
array_push($datos, array($cliente->email));
}
$sheet->fromModel($datos, null, 'A1', false, false);
$sheet->row(1, function ($row) {
// call cell manipulation methods
$row->setFontWeight('bold');
});
});
})->download('xls');
}
示例4: getIdPushByPeticionCliente
public function getIdPushByPeticionCliente($id)
{
$data = Cliente::select("cliente.email", "cliente.idPush", "peticion.nombre as nombrePeticion")->join("peticion", "cliente.email", "=", "peticion.idCliente")->where("peticion.id", "=", $id)->first();
return $data;
}
示例5: validarcorreo
function validarcorreo(Request $request, Response $response)
{
$response = $response->withHeader('Content-type', 'application/json');
$response = $response->withStatus(200);
$correo = $request->getAttribute("email");
$data = Cliente::select("email")->where('email', '=', $correo)->first();
if ($data != null) {
$respuesta = json_encode(array("std" => 1, "msg" => "Este correo ya esta registrado"));
} else {
$respuesta = json_encode(array("std" => 0, "msg" => "Este correo esta disponible"));
}
$response->getBody()->write($respuesta);
return $response;
}
示例6: postReservaAnonimo
public function postReservaAnonimo(Request $request, Response $response)
{
$response = $response->withHeader('Content-type', 'application/json');
$data = json_decode($request->getBody(), true);
//VALIDAR SI EL CLIENTE EXISTE
$cli = Cliente::select("id")->where("email", "=", $data["email"])->first();
$idCliente = "";
if ($cli == null) {
try {
$cliente = new Cliente();
$cliente->email = $data['email'];
$cliente->nombres = $data['nombres'];
$cliente->apellidos = $data['apellidos'];
$cliente->telefono = "";
$cliente->pass = sha1($data['email']);
$cliente->estado = "ACTIVO";
$cliente->save();
$idCliente = $cliente->id;
} catch (Exception $err) {
}
} else {
$idCliente = $cli->id;
}
//INSERTAR TURNO
try {
$turno = new Turno();
$turno->idCliente = $idCliente;
$turno->idEmpleado = $data['idEmpleado'];
$turno->idSucursal = $data['idSucursal'];
$turno->idServicio = $data['idServicio'];
$turno->tiempo = 0;
$turno->turno = 0;
$turno->turnoReal = 0;
$turno->tipoTurno = 1;
$turno->estadoTurno = "SOLICITADO";
$turno->estado = "ACTIVO";
$turno->reserva = "A";
$turno->fechaReserva = $data['fechaReserva'];
$turno->horaReserva = $data['horaReserva'];
$horaInicial = $data['horaReserva'];
for ($i = 0; $i < $data["cupos"]; $i++) {
$segundos_horaInicial = strtotime($horaInicial);
$segundos_minutoAnadir = $data["minutos"] * 60;
$nuevaHora = date("H:i", $segundos_horaInicial + $segundos_minutoAnadir);
$horaInicial = $nuevaHora;
}
$turno->horaFinalReserva = $nuevaHora;
$turno->save();
$respuesta = json_encode(array('msg' => "Guardado correctamente", "std" => 1, "numeroTurno" => $turnoSiguiente));
$response = $response->withStatus(200);
//ENVIAR NOTIFICACION AL EMPLEADO Y AL ADMINISTRADOR DE LA SUCURSAL
} catch (Exception $err) {
$respuesta = json_encode(array('msg' => "error al pedir el turno", "std" => 0, "err" => $err->getMessage()));
$response = $response->withStatus(404);
}
$response->getBody()->write($respuesta);
return $response;
}