如果不能正常显示,请查看原文 , 或返回

DB::table undefined function in Database Seeder

@4xjbh There are several ways for accessing Facade.

'DB' is alias of 'Illuminate\Support\Facades\DB', .. check in config/app.php

hence \DB means '\Illuminate\Support\Facades\DB' - fully qualified name space.

Laravel 5 uses psr-4 class loading where you need fully qualified class names.

see .. http://www.php-fig.org/psr/psr-4/ hence first '' means it starts searching from root namespace- and includes vendor packages. If you remove '' then it searches in your own package and didn't get Illuminate\Support\Facades\DB.

返回