Initial commit

This commit is contained in:
meusinfirmary
2025-04-22 14:33:37 +07:00
commit b9891d2f81
1305 changed files with 452033 additions and 0 deletions

65
app/Models/Dana.php Executable file
View File

@ -0,0 +1,65 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
class Dana extends Model
{
const defaultSelectedDana = "
dana.*
";
const PK_ID = 1;
const MINIMUM_AMT = 1000000; // 9M
public static function listDana($filter = [])
{
$select = ''; $join = ''; $where = ''; $group_by = ''; $order_by = ''; $limit = '';
$params = [];
if (isset($filter['id'])) {
$where .= ' AND dana.id = ?';
$params[] = $filter['id'];
}
return DB::select("SELECT "
. Dana::defaultSelectedDana . "
$select
FROM t_dana as dana
$join
WHERE dana.id is not null
$where
$group_by
$order_by
$limit
;", $params);
}
public static function getDana()
{
return DB::select("SELECT * FROM t_dana WHERE id is not null;");
}
public static function getDanaById($id)
{
return DB::select("SELECT * FROM t_dana WHERE id is not null AND id = ? LIMIT 1;", [$id]);
}
public static function addDana($data)
{
$pid = DB::table("t_dana")->insertGetId($data);
return $pid;
}
public static function updateDana($id, $data)
{
return DB::table("t_dana")->where("id", $id)->update($data);
}
public static function deleteDana($id)
{
return DB::table("t_dana")->where("id", $id)->delete();
}
}