htmlentities()期望参数1为字符串,给定数组-Form :: model Laravel 5.2

时间:2018-06-27 13:03:42

标签: laravel-5.2

我正在一个发生此错误的项目中。 下面是表单打开的HTML。

{!! Form::model($user, ['method' => 'PATCH','route' => ['supplier.update', $user->id]]) !!}

$用户打印的对象

App\Models\Supplier Object
(
[table] => users
[primaryKey] => id
[fillable:protected] => Array
    (
        [0] => name
        [1] => email
        [2] => alternate_email
        [3] => password
        [4] => role_id
        [5] => default_language_id
        [6] => user_timezone
        [7] => created_by
        [8] => updated_by
        [9] => status_id
    )

[hidden:protected] => Array
    (
        [0] => password
        [1] => remember_token
    )

[connection:protected] => 
[keyType:protected] => int
[perPage:protected] => 15
[incrementing] => 1
[timestamps] => 1
[attributes:protected] => Array
    (
        [id] => 106
        [name] => TestName
        [email] => test123456789@gmail.com
        [alternate_email] => 
        [password] => 
        [role_id] => 2
        [default_language_id] => 1
        [user_timezone] => GMT
        [remember_token] => 
        [created_by] => 2
        [updated_by] => 2
        [created_at] => 2018-06-27 16:05:17
        [updated_at] => 2018-06-27 16:05:17
        [status_id] => 22
        [isEmailVerfied] => 0
        [isOnline] => 0
        [LastLogin] => 
        [provider_name] => 
        [provider_id] => 
    )

[original:protected] => Array
    (
        [id] => 106
        [name] => TestName
        [email] => test123456789@gmail.com
        [alternate_email] => 
        [password] => $2y$10$dBXUvtbQyR/.7/FxdfirMOEA6OrwexwGCtLuxb2jjglndi0y5q10K
        [role_id] => 2
        [default_language_id] => 1
        [user_timezone] => GMT
        [remember_token] => 
        [created_by] => 2
        [updated_by] => 2
        [created_at] => 2018-06-27 16:05:17
        [updated_at] => 2018-06-27 16:05:17
        [status_id] => 22
        [isEmailVerfied] => 0
        [isOnline] => 0
        [LastLogin] => 
        [provider_name] => 
        [provider_id] => 
    )

[relations:protected] => Array
    (
    )

[visible:protected] => Array
    (
    )

[appends:protected] => Array
    (
    )

[guarded:protected] => Array
    (
        [0] => *
    )

[dates:protected] => Array
    (
    )

[dateFormat:protected] => 
[casts:protected] => Array
    (
    )

[touches:protected] => Array
    (
    )

[observables:protected] => Array
    (
    )

[with:protected] => Array
    (
    )

[morphClass:protected] => 
[exists] => 1
[wasRecentlyCreated] => 
)

以另一种形式可以正常工作。

{!! Form::model($role, ['method' => 'PATCH','route' => ['role.update', $role->role_id], 'novalidate'=>'']) !!}

$角色打印对象

App\Models\Role Object
(
[table] => role_master
[primaryKey] => role_id
[fillable] => Array
    (
        [0] => role_name
        [1] => created_by
        [2] => updated_by
    )

[connection:protected] => 
[keyType:protected] => int
[perPage:protected] => 15
[incrementing] => 1
[timestamps] => 1
[attributes:protected] => Array
    (
        [role_id] => 1
        [role_name] => Admin
        [created_by] => 1
        [updated_by] => 1
        [created_at] => 2018-01-18 15:39:23
        [updated_at] => 
    )

[original:protected] => Array
    (
        [role_id] => 1
        [role_name] => Admin
        [created_by] => 1
        [updated_by] => 1
        [created_at] => 2018-01-18 15:39:23
        [updated_at] => 
    )

[relations:protected] => Array
    (
    )

[hidden:protected] => Array
    (
    )

[visible:protected] => Array
    (
    )

[appends:protected] => Array
    (
    )

[guarded:protected] => Array
    (
        [0] => *
    )

[dates:protected] => Array
    (
    )

[dateFormat:protected] => 
[casts:protected] => Array
    (
    )

[touches:protected] => Array
    (
    )

[observables:protected] => Array
    (
    )

[with:protected] => Array
    (
    )

[morphClass:protected] => 
[exists] => 1
[wasRecentlyCreated] => 
)

角色表运行正常,而供应商表运行不正常。 如果我从Form ::模型中删除$ user变量,则它不会产生错误,并且可以正常工作。

即。 {!!形式:: model('',['method'=>'PATCH','route'=> ['supplier.update',$ user-> id]])!!}

我不知道实际的问题在哪里。我已经花了3个多小时。关于它,但不能解决这个问题。

0 个答案:

没有答案