1 | <?php |
||
2 | |||
3 | namespace Chuckbe\Chuckcms\Models; |
||
4 | |||
5 | use ChuckSite; |
||
0 ignored issues
–
show
|
|||
6 | use Illuminate\Database\Eloquent\Model as Eloquent; |
||
7 | use Spatie\EloquentSortable\Sortable; |
||
8 | use Spatie\EloquentSortable\SortableTrait; |
||
9 | use Spatie\Translatable\HasTranslations; |
||
10 | |||
11 | class Page extends Eloquent implements Sortable |
||
12 | { |
||
13 | use SortableTrait; |
||
14 | use HasTranslations; |
||
15 | |||
16 | public $sortable = [ |
||
17 | 'order_column_name' => 'order', |
||
18 | 'sort_when_creating' => true, |
||
19 | ]; |
||
20 | |||
21 | public function template() |
||
22 | { |
||
23 | return $this->belongsTo('Chuckbe\Chuckcms\Models\Template'); |
||
24 | } |
||
25 | |||
26 | public function page_blocks() |
||
27 | { |
||
28 | return $this->hasMany('Chuckbe\Chuckcms\Models\PageBlock')->orderBy('order'); |
||
29 | } |
||
30 | |||
31 | public function getById($id) |
||
32 | { |
||
33 | return $this->where('id', $id)->first(); |
||
34 | } |
||
35 | |||
36 | public function getByIdWithBlocks($id) |
||
37 | { |
||
38 | return $this->where('id', $id)->with('page_blocks')->first(); |
||
39 | } |
||
40 | |||
41 | public static function getUrl($id) |
||
42 | { |
||
43 | return ChuckSite::getSetting('domain').'/'.self::where('id', $id)->first()->slug; |
||
44 | } |
||
45 | |||
46 | public function deleteById($id) |
||
47 | { |
||
48 | $page = $this->where('id', $id)->first(); |
||
49 | if ($page) { |
||
50 | PageBlock::where('page_id', $page->id)->delete(); |
||
51 | if ($page->delete()) { |
||
52 | return 'success'; |
||
53 | } else { |
||
54 | return 'error'; |
||
55 | } |
||
56 | } else { |
||
57 | return 'false'; |
||
58 | } |
||
59 | } |
||
60 | |||
61 | public $translatable = ['title', 'slug']; |
||
62 | |||
63 | protected $casts = [ |
||
64 | 'meta' => 'array', |
||
65 | ]; |
||
66 | |||
67 | /** |
||
68 | * The attributes that are mass assignable. |
||
69 | * |
||
70 | * @var array |
||
71 | */ |
||
72 | protected $fillable = [ |
||
73 | 'order_column', |
||
74 | ]; |
||
75 | } |
||
76 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths