laravel controller include file code example
Example 1: include a file in laravel controller
require_once __DIR__ . '/../app/Utilities/FileName.php';
Example 2: how to put external file in laravel listener class
namespace App\Http\Controllers;
use App\Classes\PricesClass;
class PagesController extends Controller
{
/**
* Display homepage.
*
* @return Response
*/
public function getHome()
{
$pricesClass = new PricesClass();
$prices = $pricesClass->getPrices();
return view('pages.home', compact('prices'));
}
}