一切都工作正常,直到我开始users
在blogs
表中使用表id作为外键并尝试将其迁移到数据库中.我开始得到错误
SQLSTATE [42000]:语法错误或访问冲突:1064 SQL语法中有错误; 检查与您的MariaDB服务器版本对应的手册,以便在第1行使用'unsigned not null,
modelName
varchar(191)not null,title
varchar(191)not n' 附近使用正确的SYN ax (SQL:create tableblogs
(id
int unsigned not null) auto_increment主键,user_id
varchar(191)unsigned not null,modelName
varchar(191)not null,title
varchar(191)not null,price
int unsigned not null,description
text not n ull,status
int not null,photo_id
varchar(191)not null,company_id
varchar(191 )not null default'1 ',created_at
timestamp null,updated_at
timestamp null)default c haracter set utf8mb4 collate utf8mb4_unicode_ci)在Connection.php第445行:SQLSTATE [42000]:语法错误或访问冲突:1064 SQL语法中有错误; 查看与您的MariaDB服务器版本对应的手册,以便在第1行使用'unsigned not null,modelName …
我正在使用 jQuery 日历以如下形式输入日期
<div class="form-group">
<label>Valid From:</label>
<div class="input-group date">
<div class="input-group-addon">
<i class="fa fa-calendar"></i>
</div>
<input type="text" tabindex="4" data-date-start-date="0d" class="form-
control pull-right datepicker" name="valid_from" id="datepicker2" value="
{{old('valid_from')}}">
</div>
@if ($errors->has('valid_from'))
<span class="has-error" style="color: red">
<strong>{{ $errors->first('valid_from') }}</strong>
</span>
@endif
</div>
Run Code Online (Sandbox Code Playgroud)
我从 form 中获取2018 年 9 月 3 日形式的值。
模型代码,我尝试用 mutator 转换它,但它对模型代码不起作用
use SoftDeletes;
protected $fillable =
['name','valid_from','valid_to','city_id','p_limit','is_active','type'];
protected $dates = [
// 'valid_from',
// 'valid_to',
'deleted_at'
];
// public function setDateOfBirthAttribute($dates)
// {
// $this->attributes['valid_from'] = Carbon::parse($dates); …
Run Code Online (Sandbox Code Playgroud)