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

OJModel   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 6
Bugs 0 Features 1
Metric Value
eloc 8
dl 0
loc 32
rs 10
c 6
b 0
f 1
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A insertOJ() 0 3 1
A oid() 0 3 1
A removeOJ() 0 3 1
A updateOJ() 0 3 1
A basic() 0 3 1
A ocode() 0 3 1
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