ParseError: syntax error, unexpected identifier "JobOpportunities"

ParseError: syntax error, unexpected identifier "JobOpportunities"

我收到以下错误。

错误

ParseError: syntax error, unexpected identifier "JobOpportunities"

JobOpportunitiesController

public function index(Request $request)
{
    $job_opportunities JobOpportunities::get();
    
    if ($request->ajax()) {
        $allData = DataTables::of($job_opportunities)
            ->addIndexColumn()
            ->addColumn('action', function($row) {
                $btn = '<a href="javascript:void(0)" data-toggle="tooltip" data-id="'.$row->id.'" data-original-title="Edit" class="edit btn btn-primary btn-sm editJobOpportunities">Edit</a>';
                $btn.= '<a href="javascript:void(0)" data-toggle="tooltip" data-id="'.$row->id.'" data-original-title="Delete" class="edit btn btn-danger btn-sm deleteJobOpportunities">Delete</a>';
                return $btn;
            })
            ->rawColumns(['action'])
            ->make(true);

        return $allData;
    }

    return view('System_admin.job_hiring_setup', compact('job_opportunities'));
}

您的问题是:

$job_opportunities JobOpportunities::get();

您缺少=

$job_opportunities = JobOpportunities::get();