-
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.
Add Resource classes for crud and wip over controllers
- Loading branch information
Showing
11 changed files
with
243 additions
and
149 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,45 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers; | ||
|
||
use App\Http\Controllers\Base\Controller; | ||
use App\Http\Resources\AllResourse; | ||
use App\Http\Resources\CreateResource; | ||
use App\Http\Resources\DeleteResource; | ||
use App\Http\Resources\SingleResource; | ||
use App\Http\Resources\UpdateResource; | ||
use App\Services\Interfaces\IActionHistoryService; | ||
|
||
class ActionHistoryController extends Controller | ||
{ | ||
|
||
public function __construct(private IActionHistoryService $actionHistoryService) | ||
{ | ||
} | ||
|
||
|
||
public function all() | ||
{ | ||
return new AllResourse($this->actionHistoryService->all()); | ||
} | ||
|
||
public function single() | ||
{ | ||
return new SingleResource($this->actionHistoryService->single()); | ||
} | ||
|
||
public function create() | ||
{ | ||
return new CreateResource($this->actionHistoryService->create()); | ||
} | ||
|
||
public function update() | ||
{ | ||
return new UpdateResource($this->actionHistoryService->update()); | ||
} | ||
|
||
public function delete() | ||
{ | ||
return new DeleteResource($this->actionHistoryService->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
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,19 @@ | ||
<?php | ||
|
||
namespace App\Http\Resources; | ||
|
||
use Illuminate\Http\Request; | ||
use Illuminate\Http\Resources\Json\JsonResource; | ||
|
||
class AllResourse extends JsonResource | ||
{ | ||
/** | ||
* Transform the resource into an array. | ||
* | ||
* @return array<string, mixed> | ||
*/ | ||
public function toArray(Request $request): array | ||
{ | ||
return parent::toArray($request); | ||
} | ||
} |
Oops, something went wrong.