You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
namespace App;
use Illuminate\Database\Eloquent\Model;
class Manager extends Model
{
protected $connection = 'moodlemanager';
protected $table = 'managers';
protected $fillable = ['moodle_id'];
public function moodleUser()
{
return $this->hasOne('App\MoodleUser', 'id', 'moodle_id');
}
}
MoodleUser.php
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class MoodleUser extends Model
{
protected $connection = 'moodle';
protected $table = 'mdl_user';
protected $fillable = ['username', 'firstname', 'lastname'];
public function Manager()
{
return $this->hasOne('App\Manager', 'id', 'moodle_id');
}
}
DashboardController
<?php
namespace App\Http\Controllers\Dashboard;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Http\Requests;
use App\Manager;
use App\MoodleUser;
class DashboardController extends Controller
{
//Datatable ajax response function
public function index(Request $request)
{
$data = Manager ::select'*')
->with(['MoodleUser ']);
return Datatables::of($data)
->editColumn('MoodleUser ', function ($data) {
$actions = $data->MoodleUser->userName;
return $actions;
})
->make(true);
}
}
I have two models with different database connection. I load datatable with relation it's working fine with loading but when search it's not working got error SQLSTATE[42S02]: Base table or view not found: 1146 Table
Please give me any suggestion.
Thanks.
Operating System
PHP Version 8.1
Laravel Version 9
Laravel-Datatables Version 10
The text was updated successfully, but these errors were encountered:
Manager.php
MoodleUser.php
DashboardController
I have two models with different database connection. I load datatable with relation it's working fine with loading but when search it's not working got error SQLSTATE[42S02]: Base table or view not found: 1146 Table
Please give me any suggestion.
Thanks.
The text was updated successfully, but these errors were encountered: