相关疑难解决方法(0)

ReflectionException:类ClassName不存在 - Laravel

很快,我正在输入php artisan db:seed命令.

我得错误了:

[ReflectionException]
类UserTableSeeder不存在

root@dd-desktop:/opt/lampp/htdocs/dd/laravel# php artisan db:seed

在这里,是我的UserTableSeeder.phpDatabaseSeeder.phpPage

UserTableSeeder.php

<?php
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;

class UserTableSeeder extends Seeder
{    
    public function run()
    {
        DB::table('users')->delete();
        User::create(array(
        'name'     => 'Chris Sevilleja',
        'username' => 'sevilayha',
        'email'    => 'chris@scotch.io',
        'password' => Hash::make('awesome'),
        ));
    }    
}
Run Code Online (Sandbox Code Playgroud)

DatabaseSeeder.php

<?php

use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;

class DatabaseSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        //Model::unguard();

        Eloquent::unguard(); …
Run Code Online (Sandbox Code Playgroud)

php laravel laravel-5 artisan

43
推荐指数
6
解决办法
12万
查看次数

ReflectionException - 类DatabaseSeeder不存在,Laravel Seeder

我有不同的文件夹中的数据库播种器clases.当我写db:seed时,控制台显示以下错误:

[ReflectionException]   Class DatabaseSeeder does not exist , Laravel Seeder
Run Code Online (Sandbox Code Playgroud)

一类是这样的:

namespace Database\Seeds;
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;

use TiposCompromisosTableSeeder;

class DatabaseSeeder extends Seeder {

    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {

            Eloquent::unguard();

            $this->call('TiposCompromisosTableSeeder');
    }

}
Run Code Online (Sandbox Code Playgroud)

我的另一课是

namespace Database\Seeds;

use Illuminate\Support\Facades\DB;
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;

class TiposCompromisosTableSeeder extends Seeder{

    public function run(){

        DB::table('tipos')->insert(array(
            'nombre' => 'prioridad',
            'tabla' => 'compromisos',
            'str1' => 'baja',
            'int1' => 1
        ));
    }
}
Run Code Online (Sandbox Code Playgroud)

我试过用

composer dump-autoupload …
Run Code Online (Sandbox Code Playgroud)

php migration laravel eloquent

6
推荐指数
4
解决办法
1万
查看次数

标签 统计

laravel ×2

php ×2

artisan ×1

eloquent ×1

laravel-5 ×1

migration ×1