Level 52
Add this :
use Illuminate\Support\Facades\Schema;
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi Guys I have the following code,
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class SampleController extends Controller
{
public function index()
{
//Use Schema builder here
$columns = Schema::getColumnListing('users');
}
}
I get a Class 'App\Http\Controllers\Schema' not found error when running it. I understands that the the default namespace is App\Http\Controllers for controller so thats why it looks for the class in that folder. So then how do I properly include the laravel Schema Builder?
As you can see I've tried
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
Like a migration file does but its no use.
Any help would be greatly appreciated!
Thanks
Please or to participate in this conversation.