Skip to content

Commit ea4d537

Browse files
Merge pull request #214 from TheDragonCode/7.x
Added `operation` helper
2 parents f065b6d + 65efc79 commit ea4d537

13 files changed

+71
-7
lines changed

composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@
6464
"autoload": {
6565
"psr-4": {
6666
"DragonCode\\LaravelDeployOperations\\": "src/"
67-
}
67+
},
68+
"files": [
69+
"src/helpers.php"
70+
]
6871
},
6972
"autoload-dev": {
7073
"psr-4": {
25.1 KB
Loading
20.6 KB
Loading
40.4 KB
Loading
36.3 KB
Loading
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Illuminate\Database\Migrations\Migration;
6+
7+
use function DragonCode\LaravelDeployOperations\operation;
8+
9+
return new class extends Migration {
10+
public function withOperation(): string
11+
{
12+
return operation('foo/2022_10_14_000002_test2');
13+
}
14+
};

docs/topics/operation-helper.topic

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,16 @@
5858

5959
<code-block lang="bash" src="operations_helper.sh" include-lines="2" />
6060
</chapter>
61+
62+
<chapter title="Laravel Idea support" id="laravel_idea_support">
63+
<p>
64+
If you are using
65+
<a href="https://www.jetbrains.com/phpstorm/">JetBrains PhpStorm</a>
66+
with the
67+
<a href="https://laravel-idea.com">Laravel Idea</a> plugin installed,
68+
you can use the <code>operation</code> function to autocomplete.
69+
</p>
70+
71+
<img src="operation_helper_class.png" alt="operation helper" />
72+
</chapter>
6173
</topic>

docs/topics/running-operations.topic

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,5 +262,23 @@
262262
When the <code>%artisan% migrate:rollback</code> console command is called,
263263
the operation will call the <code>down</code> method if it exists in the operation file.
264264
</p>
265+
266+
<chapter title="Laravel Idea support" id="laravel_idea_support">
267+
<p>
268+
If you are using
269+
<a href="https://www.jetbrains.com/phpstorm/">JetBrains PhpStorm</a>
270+
with the
271+
<a href="https://laravel-idea.com">Laravel Idea</a> plugin installed,
272+
then autocomplete will be available to you:
273+
</p>
274+
<p>
275+
To avoid entering file names manually, you can use the <code>deploy_operation</code> helper function.
276+
All it does is to suggest IDE paths to operation files with recursive search.
277+
</p>
278+
279+
<code-block lang="php" src="with_operation_helper.php" include-lines="7-" />
280+
281+
<img src="operations_helper_function.png" alt="operation helper"/>
282+
</chapter>
265283
</chapter>
266284
</topic>

ide.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
"methodNames": [
3131
"run"
3232
],
33+
"functionFqn": [
34+
"DragonCode\\LaravelDeployOperations\\operation"
35+
],
3336
"place": "parameter",
3437
"parameters": [
3538
1

src/helpers.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace DragonCode\LaravelDeployOperations;
6+
7+
if (! function_exists('\DragonCode\LaravelDeployOperations\operation')) {
8+
function operation(string $filename): string
9+
{
10+
return $filename;
11+
}
12+
}

0 commit comments

Comments
 (0)