Import_mapping   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 48
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getSheetColumns() 0 10 2
1
<?php
2
3
namespace App\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
7
class Import_mapping extends Model  {
8
9
    /**
10
     * The database table used by the model.
11
     *
12
     * @var string
13
     */
14
    protected $table = 'import_mapping';
15
16
    /**
17
     * Attributes that should be mass-assignable.
18
     *
19
     * @var array
20
     */
21
    protected $fillable = ['model', 'column_name', 'description', 'order', 'is_optional', 'foreign_key', 'lookup_plugin', 'lookup_model', 'lookup_column'];
22
23
    /**
24
     * The attributes excluded from the model's JSON form.
25
     *
26
     * @var array
27
     */
28
    protected $hidden = [];
29
30
    /**
31
     * The attributes that should be casted to native types.
32
     *
33
     * @var array
34
     */
35
    protected $casts = [];
36
37
    /**
38
     * The attributes that should be mutated to dates.
39
     *
40
     * @var array
41
     */
42
    protected $dates = [];
43
44
45
    public static  function getSheetColumns($model = null){
46
        $columns = Import_mapping::where('model', '=', $model)
47
            ->orderBy('order')
48
            ->get()->toArray();
49
        $slugs = [];
50
        foreach ($columns as $column) {
51
52
            $slugs[] = $column['slug'];
53
        }
54
        return $slugs;
55
    }
56
   
57
58
}