Closed
Description
Summary of problem or feature request
When using a non-standard model the data does not appear
Code snippet of problem
Model GateImportIn.php
namespace App\Models\TpsOnline;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Models\TpsOnline\AutoPenegahan;
use Illuminate\Database\Eloquent\Relations\HasOne;
class GateImportIn extends Model
{
use HasFactory;
protected $connection = 'tpsonline_mau';
protected $table = 'get_imp_in';
protected $primaryKey = 'id_kms';
const CREATED_AT = 'date_create';
const UPDATED_AT = 'date_update';
protected $fillable = array("id_kms", "kd_dok", "kd_tps", "nm_angkut", "no_voy_flight", "call_sign", "tg_tiba", "kd_gudang", "ref_num", "no_bl_awb", "tgl_bl_awb", "no_master_bl_awb", "tgl_master_bl_awb", "id_consignee", "consignee", "consignee_alm", "bruto", "uraian_brg", "no_bc11", "tgl_bc11", "no_pos_bc11", "cont_asal", "seri_kem", "kd_kem", "jml_kem", "kd_timbun", "kd_dok_inout", "no_dok_inout", "tgl_dok_inout", "wk_inout", "kd_sar_angkut", "no_pol", "pel_muat", "pel_transit", "pel_bongkar", "gudang_tujuan", "kode_kantor", "no_daftar_pabean", "tgl_daftar_pabean", "no_segel_bc", "tg_segel_bc", "no_ijin_tps", "tgl_ijin_tps", "id_kms_in", "flag_transfer", "date_create", "date_update", "respon", "token");
// protected $cacheFor = 180;
public function tegah(): HasOne
{
return $this->hasOne(AutoPenegahan::class,'no_bl_awb', 'no_bl_awb');
}
}
Route web.php
use Illuminate\Support\Facades\Route;
use App\Models\TpsOnline\GateImportIn;
Route::get('/', function () {
$table = GateImportIn::query();
return Yajra\DataTables\DataTables::of($table)->make(true);
});
screenshot error
System details
- Operating System Windows 11 with Laragon
- PHP Version PHP 8.3.8 (cli) (built: Jun 4 2024 18:52:30) (ZTS Visual C++ 2019 x64)
- Laravel Version Laravel Framework 11.33.2
- Laravel-Datatables Version yajra/laravel-datatables": "^11.0