Initial commit
This commit is contained in:
43
app/Models/ClientsDivs.php
Executable file
43
app/Models/ClientsDivs.php
Executable file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class ClientsDivs extends Model
|
||||
{
|
||||
|
||||
const DEFAULT_CID = 1; // swanusa account
|
||||
|
||||
public static function getCDivs()
|
||||
{
|
||||
return DB::select("SELECT * FROM t_clients_divs WHERE dlt is null;");
|
||||
}
|
||||
|
||||
public static function getCDivById($client_div_id)
|
||||
{
|
||||
return DB::select("SELECT * FROM t_clients_divs WHERE dlt is null AND id = ? LIMIT 1;", [$client_div_id]);
|
||||
}
|
||||
|
||||
public static function getCDivByName($name)
|
||||
{
|
||||
return DB::select("SELECT * FROM t_clients_divs WHERE dlt is null AND name = ? LIMIT 2;", [$name]);
|
||||
}
|
||||
|
||||
public static function addCDiv($data)
|
||||
{
|
||||
$client_div_id = DB::table("t_clients_divs")->insertGetId($data);
|
||||
return $client_div_id;
|
||||
}
|
||||
|
||||
public static function updateCDiv($client_div_id, $data)
|
||||
{
|
||||
return DB::table("t_clients_divs")->where("id", $client_div_id)->update($data);
|
||||
}
|
||||
|
||||
public static function deleteCDiv($client_div_id)
|
||||
{
|
||||
return DB::table("t_clients_divs")->where("id", $client_div_id)->delete();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user