LaravelFreelancerNL /
laravel-arangodb
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace LaravelFreelancerNL\Aranguent\Schema\Concerns; |
||
| 6 | |||
| 7 | use Illuminate\Support\Fluent; |
||
| 8 | |||
| 9 | trait ColumnCommands |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * Indicate that the given attributes should be renamed. |
||
| 13 | * |
||
| 14 | * @param string $from |
||
| 15 | * @param string $to |
||
| 16 | * @return Fluent |
||
| 17 | */ |
||
| 18 | 1 | public function renameColumn($from, $to) |
|
| 19 | { |
||
| 20 | 1 | $parameters = []; |
|
| 21 | 1 | $parameters['handler'] = 'aql'; |
|
| 22 | 1 | $parameters['explanation'] = "Rename the column '$from' to '$to'."; |
|
| 23 | 1 | $parameters['from'] = $from; |
|
| 24 | 1 | $parameters['to'] = $to; |
|
| 25 | |||
| 26 | 1 | return $this->addCommand('renameAttribute', $parameters); |
|
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Indicate that the given column(s) should be dropped. |
||
| 31 | * |
||
| 32 | * @param array|mixed $columns |
||
| 33 | * @return Fluent |
||
| 34 | */ |
||
| 35 | 2 | public function dropColumn($columns) |
|
| 36 | { |
||
| 37 | 2 | $columns = is_array($columns) ? $columns : func_get_args(); |
|
| 38 | |||
| 39 | 2 | $parameters = []; |
|
| 40 | 2 | $parameters['handler'] = 'aql'; |
|
| 41 | 2 | $parameters['attributes'] = $columns; |
|
| 42 | 2 | $parameters['explanation'] = 'Drop the following column(s): ' . implode(',', $columns) . '.'; |
|
| 43 | |||
| 44 | 2 | return $this->addCommand('dropColumn', $parameters); |
|
| 45 | } |
||
| 46 | } |
||
| 47 |