I'm trying to build an api rest in laravel 5.6, the api has to generate a pdf for that I'm using the DomPDF library, and probe from the web routes and it works well but when I try to do it in a controller it does not work for me that does not find the facade "PDF". Here I leave you a piece of code thanks in advance.
<?php
namespace App\Http\Controllers;
//use App\PDF;
use Illuminate\Http\Request;
class PdfController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request)
{
$pdf = PDF::loadView('vista');
return $pdf->download('carta.pdf');
//return view('vista');
}}
the error you give me is this
"Class 'App \ Http \ Controllers \ PDF' not found"
I think you're asking me to include the path where this PDF is but if it's a facade it should not work anywhere without calling it?
THANKS IN ADVANCE.