- 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>
117 lines
2.3 KiB
PHP
117 lines
2.3 KiB
PHP
<?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)
|
|
{
|
|
//
|
|
}
|
|
}
|