8000 Testing Laravel Vapor · jarnovanleeuwen/laravel-dock@2ed2885 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2ed2885

Browse files
Testing Laravel Vapor
1 parent d5f8da7 commit 2ed2885

File tree

15 files changed

+1073
-128
lines changed

15 files changed

+1073
-128
lines changed

dock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,11 @@ if [ $# -gt 0 ]; then
124124
ARGS="$@"
125125
$0 exec "php artisan $ARGS"
126126

127+
elif [ "$1" == "vapor" ]; then
128+
shift 1
129+
ARGS="$@"
130+
$0 exec "vendor/bin/vapor $ARGS"
131+
127132
else
128133
${COMPOSE} "$@"
129134
fi

src/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ npm-debug.log
1313
yarn-error.log
1414
/.idea
1515
/.vscode
16+
.vapor/
17+
.env.production
18+
.env.staging

src/app/Console/Commands/IncrementCounter.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ class IncrementCounter extends Command
2929
*/
3030
public function handle()
3131
{
32-
Cache::increment('increment-requests');
32+
// Create or increment counter
33+
$count = Cache::get($key = 'increment-requests', 0);
34+
Cache::forever($key, $count + 1);
3335

3436
IncrementCounterJob::dispatch();
3537
}

src/app/Jobs/IncrementCounter.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ class IncrementCounter implements ShouldQueue
2020
*/
2121
public function handle()
2222
{
23-
Cache::increment('counter');
23+
// Create or increment counter
24+
$count = Cache::get($key = 'counter', 0);
25+
Cache::forever($key, $count + 1);
2426
}
2527
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
namespace App\Providers;
4+
5+
use Illuminate\Support\Facades\Gate;
6+
use Illuminate\Support\ServiceProvider;
7+
8+
class VaporUiServiceProvider extends ServiceProvider
9+
{
10+
/**
11+
* Bootstrap any application services.
12+
*
13+
* @return void
14+
*/
15+
public function boot()
16+
{
17+
$this->gate();
18+
}
19+
20+
/**
21+
* Register the Vapor UI gate.
22+
*
23+
* This gate determines who can access Vapor UI in non-local environments.
24+
*
25+
* @return void
26+
*/
27+
protected function gate()
28+
{
29+
Gate::define('viewVaporUI', function ($user = null) {
30+
return true;
31+
});
32+
}
33+
34+
/**
35+
* Register any application services.
36+
*
37+
* @return void
38+
*/
39+
public function register()
40+
{
41+
//
42+
}
43+
}

src/composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
"guzzlehttp/guzzle": "^7.0.1",
1212
"laravel/framework": "^8.40 6B90 ",
1313
"laravel/horizon": "^5.7",
14-
"laravel/tinker": "^2.5"
14+
"laravel/tinker": "^2.5",
15+
"laravel/vapor-cli": "^1.39",
16+
"laravel/vapor-core": "^2.22",
17+
"laravel/vapor-ui": "^1.5"
1518
},
1619
"require-dev": {
1720
"facade/ignition": "^2.5",

0 commit comments

Comments
 (0)
0