-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure autoloading supports application and custom layers.
- Loading branch information
Showing
20 changed files
with
457 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
tests/.skeleton/src/Application/Commands/ApplicationSync.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
namespace Application\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use Infrastructure\Models\AppSession; | ||
|
||
class ApplicationSync extends Command | ||
{ | ||
protected $signature = 'application:sync'; | ||
|
||
protected $description = 'Sync application state.'; | ||
|
||
public function handle() | ||
{ | ||
$this->info('Application state synced!'); | ||
|
||
if ($secret = AppSession::getSecret()) { | ||
$this->line($secret); | ||
|
||
return; | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
tests/.skeleton/src/Application/Database/Migrations/2024_10_14_215912_application_setup.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up(): void | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down(): void | ||
{ | ||
// | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace Application\Models; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
use Lunarstorm\LaravelDDD\Factories\HasDomainFactory; | ||
|
||
class Login extends Model | ||
{ | ||
use HasDomainFactory; | ||
|
||
protected static $secret = null; | ||
|
||
public static function setSecret($secret): void | ||
{ | ||
self::$secret = $secret; | ||
} | ||
|
||
public static function getSecret(): ?string | ||
{ | ||
return self::$secret; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
namespace Application\Policies; | ||
|
||
use App\Models\User; | ||
use Application\Models\Login; | ||
use Illuminate\Auth\Access\HandlesAuthorization; | ||
|
||
class LoginPolicy | ||
{ | ||
use HandlesAuthorization; | ||
|
||
public function viewAny(User $user) | ||
{ | ||
// | ||
} | ||
|
||
public function view(User $user, Login $login) | ||
{ | ||
// | ||
} | ||
|
||
public function create(User $user) | ||
{ | ||
// | ||
} | ||
|
||
public function update(User $user, Login $login) | ||
{ | ||
// | ||
} | ||
|
||
public function delete(User $user, Login $login) | ||
{ | ||
// | ||
} | ||
|
||
public function restore(User $user, Login $login) | ||
{ | ||
// | ||
} | ||
|
||
public function forceDelete(User $user, Login $login) | ||
{ | ||
// | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
tests/.skeleton/src/Application/Providers/ApplicationServiceProvider.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace Application\Providers; | ||
|
||
use Infrastructure\Models\AppSession; | ||
use Illuminate\Foundation\Application; | ||
use Illuminate\Support\ServiceProvider; | ||
|
||
class ApplicationServiceProvider extends ServiceProvider | ||
{ | ||
public function register() | ||
{ | ||
$this->app->singleton('application-layer', function (Application $app) { | ||
return 'application-layer-singleton'; | ||
}); | ||
} | ||
|
||
/** | ||
* Bootstrap any application services. | ||
* | ||
* @return void | ||
*/ | ||
public function boot() | ||
{ | ||
AppSession::setSecret('application-secret'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace Infrastructure\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use Infrastructure\Models\AppSession; | ||
use Infrastructure\Support\Clipboard; | ||
|
||
class LogPrune extends Command | ||
{ | ||
protected $signature = 'log:prune'; | ||
|
||
protected $description = 'Prune system logs.'; | ||
|
||
public function handle() | ||
{ | ||
$this->info('System logs pruned!'); | ||
|
||
if ($secret = Clipboard::get('secret')) { | ||
$this->line($secret); | ||
|
||
return; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace Infrastructure\Models; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
use Lunarstorm\LaravelDDD\Factories\HasDomainFactory; | ||
|
||
class AppSession extends Model | ||
{ | ||
use HasDomainFactory; | ||
|
||
protected static $secret = null; | ||
|
||
public static function setSecret($secret): void | ||
{ | ||
self::$secret = $secret; | ||
} | ||
|
||
public static function getSecret(): ?string | ||
{ | ||
return self::$secret; | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
tests/.skeleton/src/Infrastructure/Policies/AppSessionPolicy.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
namespace Infrastructure\Policies; | ||
|
||
use App\Models\User; | ||
use Illuminate\Auth\Access\HandlesAuthorization; | ||
use Infrastructure\Models\AppSession; | ||
|
||
class AppSessionPolicy | ||
{ | ||
use HandlesAuthorization; | ||
|
||
public function viewAny(User $user) | ||
{ | ||
// | ||
} | ||
|
||
public function view(User $user, AppSession $appSession) | ||
{ | ||
// | ||
} | ||
|
||
public function create(User $user) | ||
{ | ||
// | ||
} | ||
|
||
public function update(User $user, AppSession $appSession) | ||
{ | ||
// | ||
} | ||
|
||
public function delete(User $user, AppSession $appSession) | ||
{ | ||
// | ||
} | ||
|
||
public function restore(User $user, AppSession $appSession) | ||
{ | ||
// | ||
} | ||
|
||
public function forceDelete(User $user, AppSession $appSession) | ||
{ | ||
// | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
tests/.skeleton/src/Infrastructure/Providers/InfrastructureServiceProvider.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace Infrastructure\Providers; | ||
|
||
use Illuminate\Foundation\Application; | ||
use Illuminate\Support\ServiceProvider; | ||
use Infrastructure\Support\Clipboard; | ||
|
||
class InfrastructureServiceProvider extends ServiceProvider | ||
{ | ||
public function register() | ||
{ | ||
$this->app->singleton('infrastructure-layer', function (Application $app) { | ||
return 'infrastructure-layer-singleton'; | ||
}); | ||
} | ||
|
||
/** | ||
* Bootstrap any application services. | ||
* | ||
* @return void | ||
*/ | ||
public function boot() | ||
{ | ||
Clipboard::set('secret', 'infrastructure-secret'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace Infrastructure\Support; | ||
|
||
class Clipboard | ||
{ | ||
protected static $clips = []; | ||
|
||
public static function set(string $key, $value): void | ||
{ | ||
data_set(static::$clips, $key, $value); | ||
} | ||
|
||
public static function get(string $key) | ||
{ | ||
return data_get(static::$clips, $key); | ||
} | ||
} |
Oops, something went wrong.