* wip * fix * wip * #63 - permissions Co-authored-by: EwelinaLasowy <ewelina.lasowy@blumilk.pl>
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Toby\Domain\States\VacationRequest;
|
||||
|
||||
class AcceptedByAdministrative extends VacationRequestState
|
||||
{
|
||||
public static string $name = "accepted_by_administrative";
|
||||
}
|
10
app/Domain/States/VacationRequest/AcceptedByTechnical.php
Normal file
10
app/Domain/States/VacationRequest/AcceptedByTechnical.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Toby\Domain\States\VacationRequest;
|
||||
|
||||
class AcceptedByTechnical extends VacationRequestState
|
||||
{
|
||||
public static string $name = "accepted_by_technical";
|
||||
}
|
10
app/Domain/States/VacationRequest/Approved.php
Normal file
10
app/Domain/States/VacationRequest/Approved.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Toby\Domain\States\VacationRequest;
|
||||
|
||||
class Approved extends VacationRequestState
|
||||
{
|
||||
public static string $name = "approved";
|
||||
}
|
10
app/Domain/States/VacationRequest/Cancelled.php
Normal file
10
app/Domain/States/VacationRequest/Cancelled.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Toby\Domain\States\VacationRequest;
|
||||
|
||||
class Cancelled extends VacationRequestState
|
||||
{
|
||||
public static string $name = "cancelled";
|
||||
}
|
10
app/Domain/States/VacationRequest/Created.php
Normal file
10
app/Domain/States/VacationRequest/Created.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Toby\Domain\States\VacationRequest;
|
||||
|
||||
class Created extends VacationRequestState
|
||||
{
|
||||
public static string $name = "created";
|
||||
}
|
10
app/Domain/States/VacationRequest/Rejected.php
Normal file
10
app/Domain/States/VacationRequest/Rejected.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Toby\Domain\States\VacationRequest;
|
||||
|
||||
class Rejected extends VacationRequestState
|
||||
{
|
||||
public static string $name = "rejected";
|
||||
}
|
39
app/Domain/States/VacationRequest/VacationRequestState.php
Normal file
39
app/Domain/States/VacationRequest/VacationRequestState.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Toby\Domain\States\VacationRequest;
|
||||
|
||||
use Spatie\ModelStates\Exceptions\InvalidConfig;
|
||||
use Spatie\ModelStates\State;
|
||||
use Spatie\ModelStates\StateConfig;
|
||||
|
||||
abstract class VacationRequestState extends State
|
||||
{
|
||||
/**
|
||||
* @throws InvalidConfig
|
||||
*/
|
||||
public static function config(): StateConfig
|
||||
{
|
||||
return parent::config()
|
||||
->default(Created::class)
|
||||
->allowTransition(Created::class, Approved::class)
|
||||
->allowTransition(Created::class, WaitingForTechnical::class)
|
||||
->allowTransition(Created::class, WaitingForAdministrative::class)
|
||||
->allowTransition(WaitingForTechnical::class, Rejected::class)
|
||||
->allowTransition(WaitingForTechnical::class, AcceptedByTechnical::class)
|
||||
->allowTransition(WaitingForAdministrative::class, Rejected::class)
|
||||
->allowTransition(WaitingForAdministrative::class, AcceptedByAdministrative::class)
|
||||
->allowTransition(AcceptedByTechnical::class, WaitingForAdministrative::class)
|
||||
->allowTransition(AcceptedByTechnical::class, Approved::class)
|
||||
->allowTransition(AcceptedByAdministrative::class, Approved::class)
|
||||
->allowTransition([
|
||||
Created::class,
|
||||
WaitingForTechnical::class,
|
||||
WaitingForAdministrative::class,
|
||||
AcceptedByTechnical::class,
|
||||
AcceptedByAdministrative::class,
|
||||
Approved::class,
|
||||
], Cancelled::class);
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Toby\Domain\States\VacationRequest;
|
||||
|
||||
class WaitingForAdministrative extends VacationRequestState
|
||||
{
|
||||
public static string $name = "waiting_for_administrative";
|
||||
}
|
10
app/Domain/States/VacationRequest/WaitingForTechnical.php
Normal file
10
app/Domain/States/VacationRequest/WaitingForTechnical.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Toby\Domain\States\VacationRequest;
|
||||
|
||||
class WaitingForTechnical extends VacationRequestState
|
||||
{
|
||||
public static string $name = "waiting_for_technical";
|
||||
}
|
Reference in New Issue
Block a user