Closed Workaja closed 5 years ago
Need to reference the namespace properly :+1: Because Module
is a registered facade, it's located at the root namespace, so you need to do one of these two things to access it properly:
\Module::all()
Inform PHP where the Module
facade is located by specifying a use
statement in your class, then you may simply use Module::all()
without the forward slash in your code:
<?php
use Module;
...
class YourController extends Controller
{
...
There's an excellent article on understanding namespaces on Dayle Rees' blog that I recommend, found here: https://daylerees.com/php-pandas-namespaces/
Hope this helps :+1:
sorry for newbie question, how to accessing the api from controller, which non modular controller
my controller located on: app\http\controllers\admincontroller.php inside of the controller, I try to call Module::all();
but it return error: Class 'App\Http\Controllers\Module' not found
I assume it very fresh install with php 7 (xampp) and laravel 5.7