Php SQLSTATE[42S02]:未找到基表或视图:1146 table';docgenerator.课程和#x27;不';不存在

Php SQLSTATE[42S02]:未找到基表或视图:1146 table';docgenerator.课程和#x27;不';不存在,php,mysql,laravel,Php,Mysql,Laravel,我见过和我的问题类似的问题,但没有一个能真正帮助我 代码如下: 控制器(创建和存储方法) 模型 class Curriculum extends Model { // protected $fillable = ['curriculum_code', 'curriculum_title', 'company_id', 'user_id', ]; public function company() {

我见过和我的问题类似的问题,但没有一个能真正帮助我

代码如下:

控制器(创建和存储方法)

模型

class Curriculum extends Model
{
    //
    protected $fillable = ['curriculum_code',
        'curriculum_title',
        'company_id',
        'user_id',
    ];

    public function company()
    {
        return $this->belongsTo('App\Company');
    }

    public function user()
    {
        return $this->belongsTo('App\User');
    }
}
刀片

<form method="post" action="{{route('curriculums.store')}}">
                         {{csrf_field()}}

                         <div class="box-body">
                             <div class="row">
                                 <div class="col-12">
                                     <div class="form-group {{$errors->has('curriculum_code') ? 'has-error': ''}}">
                                         <label for="name" class="col-sm-2 col-form-label">Curriculum Code<span class="danger">*</span> </label>
                                         <div class="col-sm-10">
                                             <input class="form-control" name="curriculum_code" type="text" value="" id="example-text-input">
                                             @if($errors->has('curriculum_code'))
                                                 <span class="help-block">{{$errors->first('first')}}</span>
                                             @endif
                                         </div>
                                     </div>
                                     <div class="form-group {{$errors->has('curriculum_title') ? 'has-error': ''}}">
                                         <label for="name" class="col-sm-2 col-form-label">Curriculum Title<span class="danger">*</span> </label>
                                         <div class="col-sm-10">
                                             <input class="form-control" name="curriculum_title" type="text" value="" id="example-text-input">
                                             @if($errors->has('curriculum_title'))
                                                 <span class="help-block">{{$errors->first('first')}}</span>
                                             @endif
                                         </div>
                                     </div>
                                    <div class="form-group ">
                                        <label for="company" class="col-sm-2 col-form-label">Development Quality Partner<span class="danger">*</span> </label>
                                        <div class="col-sm-10">

                                                <select class="form-control select2" style="width: 100%;" name="company_id">
                                                   @foreach($companies as $company)
                                                      <option value="{{$company->id}}">{{$company->name}}</option>
                                                   @endforeach
                                                </select>

                                        </div>
                                    </div>
                                 </div>
                             </div>
                             <div class="text-xs-right">
                                 <button type="submit" class="btn btn-info" value="Submit">Occupational Information</button>
                             </div>

                         </div>
                     </form>

{{csrf_field()}}
课程守则*
@如果($errors->has('currency_code'))
{{$errors->first('first')}
@恩迪夫
课程名称*
@如果($errors->has('currency_title'))
{{$errors->first('first')}
@恩迪夫
发展质量伙伴*
@foreach($公司作为$公司)
{{$company->name}
@endforeach
职业信息

我知道当试图将数据插入数据库时,控制器中会出现问题。我之所以如此纠结于此,主要原因是:数据库不包含任何名为“课程”的表,控制器也不包含单词“课程”。我是拉拉维尔的新手,因此非常感谢您的帮助。课程表应称为
课程表,因为它是
课程表的复数形式

如果使用不同的名称,请在模型中执行以下操作:

protected $table = 'custom_table_name';

了解有关my best practices repo的更多信息。

如果表名不是模型名的复数形式,则应在如下表变量中指定它

添加受保护的
$table='课程'像这样创建模型

class Curriculum extends Model
{

    protected $table = 'curricula';
    //
    protected $fillable = ['curriculum_code',
        'curriculum_title',
        'company_id',
        'user_id',
    ];

    public function company()
    {
        return $this->belongsTo('App\Company');
    }

    public function user()
    {
        return $this->belongsTo('App\User');
    }
}
class Curriculum extends Model
{

    protected $table = 'curricula';
    //
    protected $fillable = ['curriculum_code',
        'curriculum_title',
        'company_id',
        'user_id',
    ];

    public function company()
    {
        return $this->belongsTo('App\Company');
    }

    public function user()
    {
        return $this->belongsTo('App\User');
    }
}