-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit cdb6848
Showing
46 changed files
with
5,365 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
APP_ENV=local | ||
APP_DEBUG=true | ||
APP_KEY= | ||
APP_TIMEZONE=UTC | ||
|
||
DB_CONNECTION=mysql | ||
DB_HOST=127.0.0.1 | ||
DB_PORT=3306 | ||
DB_DATABASE=homestead | ||
DB_USERNAME=homestead | ||
DB_PASSWORD=secret | ||
|
||
CACHE_DRIVER=file | ||
QUEUE_DRIVER=sync |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/vendor | ||
/.idea | ||
Homestead.json | ||
Homestead.yaml | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use Illuminate\Auth\Authenticatable; | ||
use Laravel\Lumen\Auth\Authorizable; | ||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; | ||
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract; | ||
|
||
class Cliente extends Model{ | ||
protected $table = 'modelo_cliente'; | ||
/** | ||
* The attributes that are mass assignable. | ||
* | ||
* @var array | ||
*/ | ||
protected $fillable = [ | ||
'cedula','nombres','apellidos','genero','estado_civil','fecha_nacimiento','correo','celular','telefono', | ||
]; | ||
|
||
public $timestamps = false; | ||
|
||
/** | ||
* The attributes excluded from the model's JSON form. | ||
* | ||
* @var array | ||
*/ | ||
|
||
/* | ||
protected $hidden = [ | ||
'password', | ||
]; | ||
*/ | ||
|
||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace App\Console; | ||
|
||
use Illuminate\Console\Scheduling\Schedule; | ||
use Laravel\Lumen\Console\Kernel as ConsoleKernel; | ||
|
||
class Kernel extends ConsoleKernel | ||
{ | ||
/** | ||
* The Artisan commands provided by your application. | ||
* | ||
* @var array | ||
*/ | ||
protected $commands = [ | ||
// | ||
]; | ||
|
||
/** | ||
* Define the application's command schedule. | ||
* | ||
* @param \Illuminate\Console\Scheduling\Schedule $schedule | ||
* @return void | ||
*/ | ||
protected function schedule(Schedule $schedule) | ||
{ | ||
// | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use Illuminate\Auth\Authenticatable; | ||
use Laravel\Lumen\Auth\Authorizable; | ||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; | ||
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract; | ||
|
||
class Cuenta extends Model{ | ||
protected $table = 'modelo_cuenta'; | ||
/** | ||
* The attributes that are mass assignable. | ||
* | ||
* @var array | ||
*/ | ||
protected $fillable = [ | ||
'numero','estado','fechaApertura','tipoCuenta','saldo','cliente_id', | ||
]; | ||
|
||
public $timestamps = false; | ||
|
||
/** | ||
* The attributes excluded from the model's JSON form. | ||
* | ||
* @var array | ||
*/ | ||
|
||
protected $primaryKey = 'cuenta_id'; | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace App\Events; | ||
|
||
use Illuminate\Queue\SerializesModels; | ||
|
||
abstract class Event | ||
{ | ||
use SerializesModels; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
namespace App\Events; | ||
|
||
class ExampleEvent extends Event | ||
{ | ||
/** | ||
* Create a new event instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
// | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace App\Exceptions; | ||
|
||
use Exception; | ||
use Illuminate\Validation\ValidationException; | ||
use Illuminate\Auth\Access\AuthorizationException; | ||
use Illuminate\Database\Eloquent\ModelNotFoundException; | ||
use Laravel\Lumen\Exceptions\Handler as ExceptionHandler; | ||
use Symfony\Component\HttpKernel\Exception\HttpException; | ||
|
||
class Handler extends ExceptionHandler | ||
{ | ||
/** | ||
* A list of the exception types that should not be reported. | ||
* | ||
* @var array | ||
*/ | ||
protected $dontReport = [ | ||
AuthorizationException::class, | ||
HttpException::class, | ||
ModelNotFoundException::class, | ||
ValidationException::class, | ||
]; | ||
|
||
/** | ||
* Report or log an exception. | ||
* | ||
* This is a great spot to send exceptions to Sentry, Bugsnag, etc. | ||
* | ||
* @param \Exception $e | ||
* @return void | ||
*/ | ||
public function report(Exception $e) | ||
{ | ||
parent::report($e); | ||
} | ||
|
||
/** | ||
* Render an exception into an HTTP response. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param \Exception $e | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function render($request, Exception $e) | ||
{ | ||
return parent::render($request, $e); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Cliente; | ||
use App\Cuenta; | ||
use App\Http\Helper\ResponseBuilder; | ||
use Illuminate\Http\Request; | ||
use Laravel\Lumen\Routing\Controller as BaseController; | ||
|
||
|
||
|
||
class ClienteController extends BaseController | ||
{ | ||
#Listar todos los clientes | ||
public function index(Request $request){ | ||
$clientes = Cliente::all(); | ||
return response()->json($clientes, 200); | ||
} | ||
#Listar cliente por cedula | ||
public function getCliente(Request $request, $cedula){ | ||
if ($request->isjson()){ | ||
$cliente = Cliente::where('cedula', $cedula)->get(); | ||
#if (!$cliente->isEmpty()){ | ||
if(empty($cliente)){ | ||
$status = false; | ||
$info = 'Data is not listed successfully'; | ||
} | ||
else{ | ||
$status = true; | ||
$info = 'Data is listed successfully'; | ||
} | ||
return ResponseBuilder::result($status, $info, $cliente); | ||
} | ||
else{ | ||
$status = false; | ||
$info = 'Unauthorized'; | ||
return ResponseBuilder::result($status, $info); | ||
} | ||
} | ||
|
||
#Listar cliente por apellidos | ||
public function getClienteApellidos(Request $request, $apellido){ | ||
if ($request->isjson()){ | ||
$cliente = Cliente::where('apellidos', $apellido)->get(); | ||
#if (!$cliente->isEmpty()){ | ||
if(empty($cliente)){ | ||
$status = false; | ||
$info = 'Data is not listed successfully'; | ||
} | ||
else{ | ||
$status = true; | ||
$info = 'Data is listed successfully'; | ||
} | ||
return ResponseBuilder::result($status, $info, $cliente); | ||
} | ||
else{ | ||
$status = false; | ||
$info = 'Unauthorized'; | ||
return ResponseBuilder::result($status, $info); | ||
} | ||
} | ||
|
||
#Crear un cliente | ||
public function createCliente(Request $request){ | ||
$cliente = new Cliente(); | ||
$cuenta = new Cuenta(); | ||
$cliente->cedula = $request->cedula; | ||
$cliente->nombres = $request->nombres; | ||
$cliente->apellidos = $request->apellidos; | ||
$cliente->genero = $request->genero; | ||
$cliente->estado_civil = $request->estado_civil; | ||
$cliente->fecha_nacimiento = $request->fecha_nacimiento; | ||
$cliente->correo = $request->correo; | ||
$cliente->telefono = $request->telefono; | ||
$cliente->celular = $request->celular; | ||
$cliente->direccion = $request->direccion; | ||
$cliente->save(); | ||
#Generar número de cuenta | ||
$Numero1=rand(9999999, 99999999); | ||
$Numero2=rand(9999999, 99999999); | ||
$Numero=$Numero1*$Numero2; | ||
# | ||
$cuenta->numero = $Numero; | ||
$cuenta->estado = '1'; | ||
$cuenta->fechaApertura = $request->fechaApertura; | ||
$cuenta->tipoCuenta = $request->tipoCuenta; | ||
$cuenta->saldo = $request->saldo; | ||
$cuenta->cliente_id = $cliente->id; | ||
$cuenta->save(); | ||
//return response()->json($cliente); | ||
} | ||
|
||
#Modificar un cliente | ||
public function modifyCliente(Request $request, $cedula){ | ||
$cliente = Cliente::where('cedula', $cedula)->first(); | ||
if(empty($cliente)){ | ||
$status = false; | ||
$info = 'Data is not in the list'; | ||
} | ||
else{ | ||
#Modificación de datos | ||
$cliente->nombres = $request->nombres; | ||
$cliente->apellidos = $request->apellidos; | ||
$cliente->save(); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use Laravel\Lumen\Routing\Controller as BaseController; | ||
|
||
class Controller extends BaseController | ||
{ | ||
// | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Cliente; | ||
use App\Cuenta; | ||
use App\Http\Helper\ResponseBuilder; | ||
use Illuminate\Http\Request; | ||
use Laravel\Lumen\Routing\Controller as BaseController; | ||
|
||
|
||
|
||
class CuentaController extends BaseController | ||
{ | ||
#Listar todos los clientes | ||
public function index(Request $request){ | ||
$cuentas = Cuenta::all(); | ||
return response()->json($cuentas, 200); | ||
} | ||
|
||
|
||
#Listar cliente por cedula | ||
public function getCuenta(Request $request, $numero){ | ||
if ($request->isjson()){ | ||
$cuentas = Cuenta::where('numero', $numero)->get(); | ||
#if (!$cliente->isEmpty()){ | ||
if(empty($cuentas)){ | ||
$status = false; | ||
$info = 'Data is not listed successfully'; | ||
} | ||
else{ | ||
$status = true; | ||
$info = 'Data is listed successfully'; | ||
} | ||
return ResponseBuilder::result($status, $info, $cuentas); | ||
} | ||
else{ | ||
$status = false; | ||
$info = 'Unauthorized'; | ||
return ResponseBuilder::result($status, $info); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
class ExampleController extends Controller | ||
{ | ||
/** | ||
* Create a new controller instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
// | ||
} | ||
|
||
// | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
|
||
use Illuminate\Http\Request; | ||
use Laravel\Lumen\Routing\Controller as BaseController; | ||
|
||
class PruebaController extends BaseController | ||
{ | ||
public function index(Request $request){ | ||
return response()->json("saludo:Hola!"); | ||
} | ||
} |
Oops, something went wrong.