Welcome Guest, Not a member yet? Register   Sign In
Get data in type from DB
#1

class Wages {

protected BaseConnection $db;

public function __construct() {
$this->db = Database::connect();
}

public function get (): array {

return $this->db->table('wage')
->where('office', 2)
->orderBy('title')
->get()
->getResultArray();

}

}

I have model like this, how can i get data by types, not like string

I should do like this

<?php namespace App\Entities;

use CodeIgniter\Entity\Entity;

class Wage extends Entity {

protected $casts = [
'id' => 'integer',
'title' => 'string',
'office' => 'integer'
];

}
Reply


Messages In This Thread
Get data in type from DB - by motoroller - 03-24-2023, 01:40 AM
RE: Get data in type from DB - by iRedds - 03-24-2023, 02:58 AM
RE: Get data in type from DB - by motoroller - 03-24-2023, 11:31 AM
RE: Get data in type from DB - by kenjis - 03-24-2023, 09:49 PM



Theme © iAndrew 2016 - Forum software by © MyBB