-
Notifications
You must be signed in to change notification settings - Fork 428
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 #564 from nasirkhan/dev
Library updated
- Loading branch information
Showing
26 changed files
with
404 additions
and
169 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace Modules\Category\Enums; | ||
|
||
enum CategoryStatus: string | ||
{ | ||
case Active = 'Active'; | ||
case Inactive = 'Inactive'; | ||
case Draft = 'Draft'; | ||
|
||
public static function getAllValues(): array | ||
{ | ||
return array_column(self::cases(), 'value'); | ||
} | ||
|
||
public static function getAllNames(): array | ||
{ | ||
return array_column(self::cases(), 'name'); | ||
} | ||
|
||
public static function toArray(): array | ||
{ | ||
$array = []; | ||
foreach (self::cases() as $case) { | ||
$array[$case->name] = $case->value; | ||
} | ||
|
||
return $array; | ||
} | ||
} |
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,30 @@ | ||
<?php | ||
|
||
namespace Modules\Post\Enums; | ||
|
||
enum PostStatus: string | ||
{ | ||
case Published = 'Published'; | ||
case Unpublished = 'Unpublished'; | ||
case Draft = 'Draft'; | ||
|
||
public static function getAllValues(): array | ||
{ | ||
return array_column(self::cases(), 'value'); | ||
} | ||
|
||
public static function getAllNames(): array | ||
{ | ||
return array_column(self::cases(), 'name'); | ||
} | ||
|
||
public static function toArray(): array | ||
{ | ||
$array = []; | ||
foreach (self::cases() as $case) { | ||
$array[$case->name] = $case->value; | ||
} | ||
|
||
return $array; | ||
} | ||
} |
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,30 @@ | ||
<?php | ||
|
||
namespace Modules\Post\Enums; | ||
|
||
enum PostType: string | ||
{ | ||
case Article = 'Article'; | ||
case News = 'News'; | ||
case Feature = 'Feature'; | ||
|
||
public static function getAllValues(): array | ||
{ | ||
return array_column(self::cases(), 'value'); | ||
} | ||
|
||
public static function getAllNames(): array | ||
{ | ||
return array_column(self::cases(), 'name'); | ||
} | ||
|
||
public static function toArray(): array | ||
{ | ||
$array = []; | ||
foreach (self::cases() as $case) { | ||
$array[$case->value] = $case->name; | ||
} | ||
|
||
return $array; | ||
} | ||
} |
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
Oops, something went wrong.