0

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!

1 Answer 1

1

Your namespace in your DataTables class is off.

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.