Randy_Johnson
3 months ago
147
2
General

Undefined variable - but it is there I promise.

Posted 3 months ago by Randy_Johnson

Undefined variable table.

namespace App\Http\Controllers;

use Illuminate\Http\Request; use Illuminate\Support\Facades\DB;

class UserController extends Controller { private $table = 'users'; private $view = 'admin/user/read';

public function __construct() {
    $this->middleware('auth');
}

public function create() {

}

public function read() {
    $data = DB::table($table)->get();
    return view($view, [$table => $data]);
}

public function readSingle() {}

public function update() {}

public function delete($slug)
{
}

}

Please sign in or create an account to participate in this conversation.