Completed
Push — master ( a4261d...fc5e52 )
by John
14s
created

OJModel::ocode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace App\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Support\Facades\DB;
7
use Requests;
8
use Exception;
9
10
class OJModel extends Model
11
{
12
    protected $tableName='oj';
13
14
    public static function oid($ocode)
15
    {
16
        return DB::table('oj')->where(["ocode"=>$ocode])->first()["oid"];
17
    }
18
19
    public static function ocode($oid)
20
    {
21
        return self::basic($oid)["ocode"];
22
    }
23
24
    public static function basic($oid)
25
    {
26
        return DB::table('oj')->where(["oid"=>$oid])->first();
27
    }
28
29
    public static function insertOJ($row)
30
    {
31
        return DB::table('oj')->insertGetId($row);
32
    }
33
34
    public static function updateOJ($oid, $row)
35
    {
36
        return DB::table('oj')->where(["oid"=>$oid])->update($row);
37
    }
38
39
    public static function removeOJ($filter)
40
    {
41
        return DB::table('oj')->where($filter)->delete();
42
    }
43
}
44