1 | <?php |
||
15 | class DataTablesMakeCommand extends GeneratorCommand |
||
16 | { |
||
17 | /** |
||
18 | * The console command name. |
||
19 | * |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $name = 'datatables:make'; |
||
23 | |||
24 | /** |
||
25 | * The console command description. |
||
26 | * |
||
27 | * @var string |
||
28 | */ |
||
29 | protected $description = 'Create a new DataTable service class.'; |
||
30 | |||
31 | /** |
||
32 | * The type of class being generated. |
||
33 | * |
||
34 | * @var string |
||
35 | */ |
||
36 | protected $type = 'DataTable'; |
||
37 | |||
38 | /** |
||
39 | * The model class to be used by dataTable. |
||
40 | * |
||
41 | * @var string |
||
42 | */ |
||
43 | protected $model; |
||
44 | |||
45 | /** |
||
46 | * DataTable export filename. |
||
47 | * |
||
48 | * @var string |
||
49 | */ |
||
50 | protected $filename; |
||
51 | |||
52 | /** |
||
53 | * Build the class with the given name. |
||
54 | * |
||
55 | * @param string $name |
||
56 | * @return string |
||
57 | */ |
||
58 | protected function buildClass($name) |
||
65 | |||
66 | /** |
||
67 | * Get the stub file for the generator. |
||
68 | * |
||
69 | * @return string |
||
70 | */ |
||
71 | protected function getStub() |
||
75 | |||
76 | /** |
||
77 | * Replace model name. |
||
78 | * |
||
79 | * @param string $stub |
||
80 | * @return mixed |
||
81 | */ |
||
82 | protected function replaceModel(&$stub) |
||
90 | |||
91 | /** |
||
92 | * Replace model import. |
||
93 | * |
||
94 | * @param string $stub |
||
95 | * @return $this |
||
96 | */ |
||
97 | protected function replaceModelImport(&$stub) |
||
105 | |||
106 | /** |
||
107 | * Replace the filename. |
||
108 | * |
||
109 | * @param string $stub |
||
110 | * @return string |
||
111 | */ |
||
112 | protected function replaceFilename(&$stub) |
||
120 | |||
121 | /** |
||
122 | * Get the console command options. |
||
123 | * |
||
124 | * @return array |
||
125 | */ |
||
126 | protected function getOptions() |
||
132 | |||
133 | /** |
||
134 | * Determine if the class already exists. |
||
135 | * |
||
136 | * @param string $rawName |
||
137 | * @return bool |
||
138 | */ |
||
139 | protected function alreadyExists($rawName) |
||
148 | |||
149 | /** |
||
150 | * Parse the name and format according to the root namespace. |
||
151 | * |
||
152 | * @param string $name |
||
153 | * @return string |
||
154 | */ |
||
155 | protected function parseName($name) |
||
173 | |||
174 | /** |
||
175 | * Get the default namespace for the class. |
||
176 | * |
||
177 | * @param string $rootNamespace |
||
178 | * @return string |
||
179 | */ |
||
180 | protected function getDefaultNamespace($rootNamespace) |
||
184 | |||
185 | /** |
||
186 | * Set the model to be used. |
||
187 | * |
||
188 | * @param string $name |
||
189 | */ |
||
190 | protected function setModel($name) |
||
198 | |||
199 | /** |
||
200 | * Set the filename for export. |
||
201 | * |
||
202 | * @param string $name |
||
203 | */ |
||
204 | protected function setFilename($name) |
||
208 | } |
||
209 |