jeudi 30 novembre 2017

Laravel DB class no table method on new project

I just can't figured out this issu; On a new Laravel project, I just can't use table method on DB class.

I use PhpStorm as EDI on OSX Sierra with Laravel 5.5.

Here my steps:

  1. In terminal: Laravel new testproject
  2. In terminal: composer install
  3. In terminal: php artisan make:controller testdummy
  4. In EDI:

    namespace App\Http\Controllers;
    
    use Illuminate\Http\Request;
    use Illuminate\Support\Facades\DB;
    
    class testdummy extends Controller
    
    {
        //
        public function index(){
            DB::table('title')->insert([
                'label' => 'test1',
                'desc' => 'test2',
            ]);
        }
    }
    
    

The 'table' have a warning popup in EDI that say:

'Method table not found in Illuminate\Support\Facades\DB'.

And no insertion are made to database.

Have you some hints on where to look next to help me find the problem?

thanks,



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire