1 | <?php namespace Arcanedev\LaravelNestedSet\Utilities; |
||
12 | class NestedSet |
||
13 | { |
||
14 | /* ----------------------------------------------------------------- |
||
15 | | Constants |
||
16 | | ----------------------------------------------------------------- |
||
17 | */ |
||
18 | /** |
||
19 | * The name of default lft column. |
||
20 | */ |
||
21 | const LFT = '_lft'; |
||
22 | |||
23 | /** |
||
24 | * The name of default rgt column. |
||
25 | */ |
||
26 | const RGT = '_rgt'; |
||
27 | |||
28 | /** |
||
29 | * The name of default parent id column. |
||
30 | */ |
||
31 | const PARENT_ID = 'parent_id'; |
||
32 | |||
33 | /** |
||
34 | * Insert direction. |
||
35 | */ |
||
36 | const BEFORE = 1; |
||
37 | |||
38 | /** |
||
39 | * Insert direction. |
||
40 | */ |
||
41 | const AFTER = 2; |
||
42 | |||
43 | /* ----------------------------------------------------------------- |
||
44 | | Getters & Setters |
||
45 | | ----------------------------------------------------------------- |
||
46 | */ |
||
47 | /** |
||
48 | * Get a list of default columns. |
||
49 | * |
||
50 | * @return array |
||
51 | */ |
||
52 | 216 | public static function getDefaultColumns() |
|
56 | |||
57 | /* ----------------------------------------------------------------- |
||
58 | | Migration Methods |
||
59 | | ----------------------------------------------------------------- |
||
60 | */ |
||
61 | /** |
||
62 | * Add default nested set columns to the table. Also create an index. |
||
63 | * |
||
64 | * @param \Illuminate\Database\Schema\Blueprint $table |
||
65 | */ |
||
66 | 216 | public static function columns(Blueprint $table) |
|
74 | |||
75 | /** |
||
76 | * Drop NestedSet columns. |
||
77 | * |
||
78 | * @param \Illuminate\Database\Schema\Blueprint $table |
||
79 | */ |
||
80 | public static function dropColumns(Blueprint $table) |
||
87 | |||
88 | /* ----------------------------------------------------------------- |
||
89 | | Check Methods |
||
90 | | ----------------------------------------------------------------- |
||
91 | */ |
||
92 | /** |
||
93 | * Replaces instanceof calls for this trait. |
||
94 | * |
||
95 | * @param mixed $node |
||
96 | * |
||
97 | * @return bool |
||
98 | */ |
||
99 | 72 | public static function isNode($node) |
|
103 | } |
||
104 |