-
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.
Merge pull request #1 from queents/dev
add slug
- Loading branch information
Showing
15 changed files
with
146 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace Modules\Base\Services\Concerns; | ||
|
||
trait HasBody | ||
{ | ||
/** | ||
* @var string | array | bool | null | ||
*/ | ||
public string | array | bool | null $body = null; | ||
|
||
public function body(string | array | bool | null $body): static | ||
{ | ||
$this->body = $body; | ||
return $this; | ||
} | ||
} |
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 Modules\Base\Services\Concerns; | ||
|
||
trait HasView | ||
{ | ||
/** | ||
* @var string | null | ||
*/ | ||
public string | null $viewType = "input"; | ||
|
||
public function viewType(string | null $viewType): static | ||
{ | ||
$this->viewType = $viewType; | ||
return $this; | ||
} | ||
} |
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,20 @@ | ||
<?php | ||
|
||
namespace Modules\Base\Services\Concerns; | ||
|
||
trait IsConfirmed | ||
{ | ||
/** | ||
* @var ?bool | ||
*/ | ||
public ?bool $confirmed = false; | ||
|
||
/** | ||
* @return $this | ||
*/ | ||
public function confirmed(bool $confirmed = true): static | ||
{ | ||
$this->confirmed = $confirmed; | ||
return $this; | ||
} | ||
} |
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,51 @@ | ||
<?php | ||
|
||
namespace Modules\Base\Services\Resource\Concerns\Actions; | ||
|
||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Validator; | ||
use Modules\Base\Services\Components\Base\Alert; | ||
|
||
trait Action | ||
{ | ||
/** | ||
* @param Request $request | ||
* @param $id | ||
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse|\Inertia\Response|void|null | ||
*/ | ||
public function action(Request $request, $id) | ||
{ | ||
/* | ||
* Check if user has role to create a new record | ||
*/ | ||
if ($this->checkRoles('canEdit') && !$this->isAPI($request)) { | ||
return $this->checkRoles('canEdit'); | ||
} | ||
|
||
/* | ||
* Check Request validation | ||
*/ | ||
$validator = Validator::make($request->all(), [ | ||
"action" => "required|string", | ||
"value" => "required" | ||
]); | ||
|
||
if (!$validator->fails()) { | ||
|
||
/* | ||
* Select Record By ID | ||
*/ | ||
$record = $this->model::find($id); | ||
|
||
/* | ||
* Process Select to be ID | ||
*/ | ||
$record->{$request->get('action')} = $request->get('value'); | ||
$record->save(); | ||
/* | ||
* Return Redirect Response if request is not API | ||
*/ | ||
return Alert::make(__($this->generateName(true, true) . " Updated Success"))->fire(); | ||
} | ||
} | ||
} |
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,20 @@ | ||
<?php | ||
|
||
namespace Modules\Base\Services\Rows; | ||
|
||
use Modules\Base\Services\Rows\Abstracts\Base; | ||
|
||
class Slug extends Base | ||
{ | ||
|
||
public string $vue = 'ViltSlug.vue'; | ||
|
||
/** | ||
* @param string $name | ||
* @return static | ||
*/ | ||
public static function make(string $name): self | ||
{ | ||
return (new self)->name($name); | ||
} | ||
} |