Initial commit: Horux Backend API
- API REST para gestion de facturas electronicas mexicanas (CFDI) - Laravel 9 con autenticacion OAuth 2.0 (Passport) - Integracion con Syntage, Clerk y Facturama - 30 modelos Eloquent, 39 controladores - Documentacion completa en /docs Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
116
app/Http/Controllers/RfcController.php
Normal file
116
app/Http/Controllers/RfcController.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Rfc;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class RfcController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtiene el RFC del frontend y lo registra en el usuario correspondiente
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function insertarRfc(Request $request)
|
||||
{
|
||||
//
|
||||
$user = $request->user();
|
||||
$rfc = Rfc::where('rfc', $request->rfc)->firstOrCreate([
|
||||
'rfc' => $request->rfc
|
||||
],
|
||||
);
|
||||
$user->rfcs()->attach($rfc);
|
||||
$user->save();
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => 'RFC agregado con exito'
|
||||
], 200);
|
||||
}
|
||||
|
||||
public function obtenerRfcs(Request $request)
|
||||
{
|
||||
$user = $request->user();
|
||||
$rfcs = $user->rfcs->pluck('rfc');
|
||||
|
||||
return $rfcs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param \App\Models\Rfc $rfc
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show(Rfc $rfc)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param \App\Models\Rfc $rfc
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit(Rfc $rfc)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \App\Models\Rfc $rfc
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, Rfc $rfc)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param \App\Models\Rfc $rfc
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy(Rfc $rfc)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user