Skip to content

Commit

Permalink
v0.0.0:beta
Browse files Browse the repository at this point in the history
  • Loading branch information
egooktafanda97 committed Mar 25, 2024
0 parents commit e4f2580
Show file tree
Hide file tree
Showing 36 changed files with 1,180 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .editorconfig
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
12 changes: 12 additions & 0 deletions .gitattributes
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/vendor/
/.idea
composer.lock
45 changes: 45 additions & 0 deletions composer.json
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
}
}
13 changes: 13 additions & 0 deletions src/Collection/Controller/Controllers.php
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')
{
}
}
13 changes: 13 additions & 0 deletions src/Collection/Controller/RestController.php
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')
{
}
}
17 changes: 17 additions & 0 deletions src/Collection/Helpers/Resources.php
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)
{
}
}
16 changes: 16 additions & 0 deletions src/Collection/Main/Repository.php
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;
});
}
}
34 changes: 34 additions & 0 deletions src/Collection/Main/RouterControllerExample.md
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.
13 changes: 13 additions & 0 deletions src/Collection/Main/Service.php
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)
{
}
}
13 changes: 13 additions & 0 deletions src/Collection/Models/BeforeAction.php
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 = [])
{
}
}
13 changes: 13 additions & 0 deletions src/Collection/Models/Model.php
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)
{
}
}
21 changes: 21 additions & 0 deletions src/Collection/Models/Rules.php
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();
}
}
19 changes: 19 additions & 0 deletions src/Collection/Models/Table.php
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)
{
}
}
13 changes: 13 additions & 0 deletions src/Collection/Props/Args.php
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 = [])
{
}
}
13 changes: 13 additions & 0 deletions src/Collection/Props/Propertis.php
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)
{
}
}
13 changes: 13 additions & 0 deletions src/Collection/Rutes/Delete.php
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)
{
}
}
13 changes: 13 additions & 0 deletions src/Collection/Rutes/Get.php
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)
{
}
}
13 changes: 13 additions & 0 deletions src/Collection/Rutes/Group.php
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)
{
}
}
13 changes: 13 additions & 0 deletions src/Collection/Rutes/Middleware.php
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)
{
}
}
13 changes: 13 additions & 0 deletions src/Collection/Rutes/Name.php
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)
{
}
}
13 changes: 13 additions & 0 deletions src/Collection/Rutes/Post.php
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)
{
}
}
13 changes: 13 additions & 0 deletions src/Collection/Rutes/Prefix.php
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)
{
}
}
Loading

0 comments on commit e4f2580

Please sign in to comment.