-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from TheM1984/feature/5-add-enum-v3-support
Feature/5 add enum v3 support
- Loading branch information
Showing
15 changed files
with
229 additions
and
47 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
/** | ||
* Contains the OrderStatus class with Enum version 2 default. | ||
* | ||
* @copyright Copyright (c) 2017 Attila Fulop | ||
* @author Mark Boessenkool | ||
* @license MIT | ||
* @since 2019-09-03 | ||
* | ||
*/ | ||
|
||
|
||
namespace Konekt\Enum\Eloquent\Tests\Models; | ||
|
||
use Konekt\Enum\Enum; | ||
|
||
class OrderStatusV2 extends Enum | ||
{ | ||
const __default = self::SUBMITTED; | ||
|
||
const SUBMITTED = 'submitted'; | ||
const PROCESSING = 'processing'; | ||
const SHIPPING = 'shipping'; | ||
const COMPLETED = 'completed'; | ||
} |
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,26 @@ | ||
<?php | ||
/** | ||
* Contains the OrderStatus class with Enum version 2 and 3 default. | ||
* | ||
* @copyright Copyright (c) 2017 Attila Fulop | ||
* @author Mark Boessenkool | ||
* @license MIT | ||
* @since 2019-09-03 | ||
* | ||
*/ | ||
|
||
|
||
namespace Konekt\Enum\Eloquent\Tests\Models; | ||
|
||
use Konekt\Enum\Enum; | ||
|
||
class OrderStatusVX extends Enum | ||
{ | ||
const __DEFAULT = self::SUBMITTED; | ||
const __default = self::SUBMITTED; // v2 default for backwards compatibility | ||
|
||
const SUBMITTED = 'submitted'; | ||
const PROCESSING = 'processing'; | ||
const SHIPPING = 'shipping'; | ||
const COMPLETED = 'completed'; | ||
} |
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,39 @@ | ||
<?php | ||
/** | ||
* Contains the Order model class for Enum version 2 default. | ||
* | ||
* @copyright Copyright (c) 2017 Attila Fulop | ||
* @author Mark Boessenkool | ||
* @license MIT | ||
* @since 2019-09-03 | ||
* | ||
*/ | ||
|
||
|
||
namespace Konekt\Enum\Eloquent\Tests\Models; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
use Konekt\Enum\Eloquent\CastsEnums; | ||
|
||
class OrderV2 extends Model | ||
{ | ||
use CastsEnums; | ||
|
||
protected $guarded = ['id']; | ||
|
||
protected $casts = [ | ||
'is_active' => 'boolean' | ||
]; | ||
|
||
protected $enums = [ | ||
'status' => OrderStatusV2::class | ||
]; | ||
|
||
/** | ||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo | ||
*/ | ||
public function client() | ||
{ | ||
return $this->belongsTo(Client::class); | ||
} | ||
} |
Oops, something went wrong.