-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e4f2580
Showing
36 changed files
with
1,180 additions
and
0 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,15 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 4 | ||
trim_trailing_whitespace = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[*.{yml,yaml,json}] | ||
indent_size = 2 |
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,12 @@ | ||
* text=auto | ||
|
||
*.md diff=markdown | ||
*.php diff=php | ||
|
||
/.github export-ignore | ||
/tests export-ignore | ||
.editorconfig export-ignore | ||
.gitattributes export-ignore | ||
.gitignore export-ignore | ||
CHANGELOG.md export-ignore | ||
phpunit.xml export-ignore |
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,3 @@ | ||
/vendor/ | ||
/.idea | ||
composer.lock |
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,45 @@ | ||
{ | ||
"name": "talium_attribute/laravel", | ||
"description": "package router attribute for laravel", | ||
"type": "library", | ||
"license": "MIT", | ||
"authors": [{ | ||
"role": "Developer", | ||
"name": "ego oktafanda", | ||
"email": "[email protected]" | ||
}], | ||
"autoload": { | ||
"psr-4": { | ||
"TaliumAttributes\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"TaliumAttributes\\Tests\\": "tests/" | ||
} | ||
}, | ||
"require": { | ||
"php": "^8.0|^8.1|^8.2", | ||
"illuminate/support": "^9.0||^10.0||^11.0" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^9.5||^10.0||^11.0", | ||
"orchestra/testbench": "^6.20||^7.0||^8.0", | ||
"illuminate/container": "^9.0||^10.0||^11.0" | ||
}, | ||
"extra": { | ||
"laravel": { | ||
"providers": [ | ||
"TaliumAttributes\\Provider\\TaliumAttributesServiceProvider" | ||
] | ||
} | ||
}, | ||
"minimum-stability": "dev", | ||
"prefer-stable": true, | ||
|
||
"config": { | ||
"sort-packages": true, | ||
"preferred-install": "dist", | ||
"optimize-autoloader": true | ||
} | ||
} |
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,13 @@ | ||
<?php | ||
|
||
namespace TaliumAttributes\Collection\Controller; | ||
|
||
use Attribute; | ||
|
||
#[Attribute] | ||
class Controllers | ||
{ | ||
public function __construct(public $controller = 'web') | ||
{ | ||
} | ||
} |
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,13 @@ | ||
<?php | ||
|
||
namespace TaliumAttributes\Collection\Controller; | ||
|
||
use Attribute; | ||
|
||
#[Attribute] | ||
class RestController | ||
{ | ||
public function __construct(public $controller = 'api') | ||
{ | ||
} | ||
} |
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,17 @@ | ||
<?php | ||
|
||
namespace TaliumAttributes\Collection; | ||
|
||
use Attribute; | ||
|
||
#[Attribute] | ||
class Resources | ||
{ | ||
public $show; | ||
public $update; | ||
public $create; | ||
|
||
public function __construct($path) | ||
{ | ||
} | ||
} |
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,16 @@ | ||
<?php | ||
|
||
namespace TaliumAttributes\Collection; | ||
|
||
use Attribute; | ||
|
||
#[Attribute] | ||
class Repository | ||
{ | ||
public function __construct($repository) | ||
{ | ||
app()->bind($repository, function () use ($repository) { | ||
return new $repository; | ||
}); | ||
} | ||
} |
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,34 @@ | ||
### Penggunaan Controller | ||
```php | ||
use TaliumAbstract\Attributes\Ruters\Get; | ||
use TaliumAbstract\Attributes\Ruters\Group; | ||
use TaliumAbstract\Attributes\Ruters\Name; | ||
use TaliumAbstract\Attributes\Controllers; | ||
use TaliumAbstract\Permission\RoleServices; | ||
|
||
#[Controllers()] | ||
#[Group(["name" => "rules", "prefix" => "rules", "group" => "rule-permission"])] | ||
#[Name("rules")] | ||
class MasterRulesController extends Controller | ||
{ | ||
#[Get("")] | ||
#[Name("set rules")] | ||
public function setUpRules(RoleServices $ruleService, Request $request) | ||
{ | ||
return $ruleService->saveRules(( | ||
new Request([ | ||
"role" => "super-admin", | ||
"gaurd_name" => "api", | ||
"guard_api" => true, | ||
]) | ||
)); | ||
} | ||
} | ||
|
||
``` | ||
#### Deskripsi | ||
- `Controllers` adalah atribut yang digunakan untuk menandai bahwa class tersebut adalah controller. | ||
- `Group` adalah atribut yang digunakan untuk menandai bahwa class tersebut adalah group dari controller. | ||
- `Name` adalah atribut yang digunakan untuk menandai bahwa class tersebut adalah nama dari controller. | ||
- `Get` adalah atribut yang digunakan untuk menandai bahwa method tersebut adalah method GET. | ||
- `Name` adalah atribut yang digunakan untuk menandai bahwa method tersebut adalah nama dari method. |
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,13 @@ | ||
<?php | ||
|
||
namespace TaliumAttributes\Collection; | ||
|
||
use Attribute; | ||
|
||
#[Attribute] | ||
class Service | ||
{ | ||
public function __construct(public $service) | ||
{ | ||
} | ||
} |
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,13 @@ | ||
<?php | ||
|
||
namespace TaliumAttributes\Collection\Models; | ||
|
||
use Attribute; | ||
|
||
#[Attribute] | ||
class BeforeAction | ||
{ | ||
public function __construct(public array $variable = []) | ||
{ | ||
} | ||
} |
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,13 @@ | ||
<?php | ||
|
||
namespace TaliumAttributes\Collection\Models; | ||
|
||
use Attribute; | ||
|
||
#[Attribute] | ||
class Model | ||
{ | ||
public function __construct(public $model) | ||
{ | ||
} | ||
} |
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,21 @@ | ||
<?php | ||
|
||
namespace TaliumAttributes\Collection\Models; | ||
|
||
use Attribute; | ||
|
||
#[Attribute] | ||
class Rules | ||
{ | ||
public $rules; | ||
/** | ||
* class static method to get the rules | ||
* @param $models | ||
* @return mixed | ||
* @throws \ReflectionException | ||
*/ | ||
public function __construct($models) | ||
{ | ||
$this->rules = $models::rules(); | ||
} | ||
} |
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,19 @@ | ||
<?php | ||
|
||
namespace TaliumAttributes\Collection\Models; | ||
|
||
use Attribute; | ||
|
||
#[Attribute] | ||
class Table | ||
{ | ||
/** | ||
* Model Table | ||
* @param string $table | ||
* @return void | ||
* @throws \ReflectionException | ||
*/ | ||
public function __construct(public $table) | ||
{ | ||
} | ||
} |
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,13 @@ | ||
<?php | ||
|
||
namespace TaliumAttributes\Collection; | ||
|
||
use Attribute; | ||
|
||
#[Attribute] | ||
class Args | ||
{ | ||
public function __construct(public $args = []) | ||
{ | ||
} | ||
} |
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,13 @@ | ||
<?php | ||
|
||
namespace TaliumAttributes\Collection; | ||
|
||
use Attribute; | ||
|
||
#[Attribute] | ||
class Propertis | ||
{ | ||
public function __construct(public $props) | ||
{ | ||
} | ||
} |
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,13 @@ | ||
<?php | ||
|
||
namespace TaliumAttributes\Collection\Rutes; | ||
|
||
use Attribute; | ||
|
||
#[Attribute] | ||
class Delete | ||
{ | ||
public function __construct(public $delete) | ||
{ | ||
} | ||
} |
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,13 @@ | ||
<?php | ||
|
||
namespace TaliumAttributes\Collection\Rutes; | ||
|
||
use Attribute; | ||
|
||
#[Attribute] | ||
class Get | ||
{ | ||
public function __construct(public $get) | ||
{ | ||
} | ||
} |
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,13 @@ | ||
<?php | ||
|
||
namespace TaliumAttributes\Collection\Rutes; | ||
|
||
use Attribute; | ||
|
||
#[Attribute] | ||
class Group | ||
{ | ||
public function __construct(public $group) | ||
{ | ||
} | ||
} |
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,13 @@ | ||
<?php | ||
|
||
namespace TaliumAttributes\Collection\Rutes; | ||
|
||
use Attribute; | ||
|
||
#[Attribute] | ||
class Middleware | ||
{ | ||
public function __construct(public $middleware) | ||
{ | ||
} | ||
} |
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,13 @@ | ||
<?php | ||
|
||
namespace TaliumAttributes\Collection\Rutes; | ||
|
||
use Attribute; | ||
|
||
#[Attribute] | ||
class Name | ||
{ | ||
public function __construct(public $name) | ||
{ | ||
} | ||
} |
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,13 @@ | ||
<?php | ||
|
||
namespace TaliumAttributes\Collection\Rutes; | ||
|
||
use Attribute; | ||
|
||
#[Attribute] | ||
class Post | ||
{ | ||
public function __construct(public $post) | ||
{ | ||
} | ||
} |
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,13 @@ | ||
<?php | ||
|
||
namespace TaliumAttributes\Collection\Rutes; | ||
|
||
use Attribute; | ||
|
||
#[Attribute] | ||
class Prefix | ||
{ | ||
public function __construct(public $prefix) | ||
{ | ||
} | ||
} |
Oops, something went wrong.