user4942382
user4942382

Reputation:

PHP Undefined Class

I am using Laravel and I have a function in my Controller as follows:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Clans;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use DB;
use App\Helpers\DataTables;


class ClansController extends Controller
{

    public function indexload(){
            $tableData = new DataTables();
            return $tableData->get('clans', 'id', array('id', 'clanid', 'name', 'location', 'level', 'exp', 'warslost', 'warstied', 'warwinpercent', 'warswon','playercount', 'score'));
    }
}

DataTables is a Class in \app\Helpers\

The page is live at: http://clashdata.tk/clans/load

You can see that the JSON is being displayed like it should but then after the JSON there is a Laravel error saying the class couldn't be found and this is causing problems for my script. How come it says the class can't be found?

The Class is available here: http://pastebin.com/Wpn9u64U

Thanks!

Upvotes: 0

Views: 540

Answers (1)

Thomas Kim
Thomas Kim

Reputation: 15961

Your namespace in your DataTables class is off.

You currently have namespace App\Helpers\DataTables;, but it should be: namespace App\Helpers;

Upvotes: 1

Related Questions