Laravel-如何解决有效载荷中的意外语法错误

时间:2020-06-17 01:41:24

标签: laravel

在我的Laravel-5.8项目中,我有以下代码:

$payloads = [
   'first_name' => $clientdata['first_name'],
   'last_name' => $clientdata['last_name'],
   'other_name' => $clientdata['middle_name']
];

if(!isset($clientdata['staff_id']) {
   payloads['dept_code'] = $clientdata['department_id'];
}

$employee = HrEmployee::updateOrCreate([
            'employee_code' => $clientdata['staff_id'],
        ], $payloads);   

我有此错误:

语法错误 意外:{ 之后:)

然后在此代码行下划线:

if(!isset($clientdata['staff_id']) {

当我更换时:

if(!isset($clientdata['staff_id']) {

使用

if(!isset($clientdata['staff_id'])) {

它现在强调了这一点:

有效载荷['nav_dept_id'] = $ clientdata ['department_id'];

语法错误 意外:= 之后:]

我怎么弄错了,我该如何解决?

谢谢

1 个答案:

答案 0 :(得分:0)

您必须像这样使用

<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>

<div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>