Home > Blockchain >  ParseError: syntax error, unexpected identifier "JobOpportunities"
ParseError: syntax error, unexpected identifier "JobOpportunities"

Time:04-04

This is my controller:

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" >Edit</a>';
                $btn.= '<a href="javascript:void(0)" data-toggle="tooltip" data-id="'.$row->id.'" data-original-title="Delete" >Delete</a>';
                return $btn;
            })
            ->rawColumns(['action'])
            ->make(true);

        return $allData;
    }

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

ParseError: syntax error, unexpected identifier "JobOpportunities"

CodePudding user response:

And this is my on my job_hiring_setup.blade.php

    <script type="text/javascript">
$(function(){
        $.ajaxSetup({
            headers:{
                'X-CSRF-TOKEN':$('meta[name="csrf-token"]').attr('content')
            }
        });
    var table = $(".data-table").DataTable({
        severSide:true,
        processinf:true,
        ajax:"{{route('job_opportunities.index')}}",
            columns:[
                {data:'DT_RowIndex',name:'DT_RowIndex'},
                {data:'company_name',name:'company_name'},
                {data:'job_title',name:'job_title'},
                {data:'job_role',name:'job_role'},
                {data:'job_requirements',name:'job_requirements'},
                {data:'company_location',name:'company_location'},
                {data:'vacancy_no',name:'vacancy_no'},
                {data:'status',name:'status'},
                {data:'action',name:'action'},
        ]
    });
 });
    
</script>

And this is my on my job_hiring_setup blade php

CodePudding user response:

Your issue is that you have:

$job_opportunities JobOpportunities::get();

You are missing the =.

$job_opportunities = JobOpportunities::get();
  • Related