-
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
1 parent
463964c
commit 02d1a4c
Showing
11 changed files
with
202 additions
and
3 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
app/Http/Controllers/WebApp/Contact/ContactGroupController.php
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,44 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\WebApp\Contact; | ||
|
||
use App\Http\Controllers\BaseResourceController; | ||
use App\Http\Requests\WebApp\Contact\CreateContactGroupRequest; | ||
use App\Http\Requests\WebApp\Contact\UpdateContactGroupRequest; | ||
use App\Services\Contact\ContactGroupService; | ||
|
||
class ContactGroupController extends BaseResourceController | ||
{ | ||
/** | ||
* Create a new controller instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct(protected ContactGroupService $contactGroupService) | ||
{ | ||
parent::__construct($contactGroupService->repository); | ||
} | ||
|
||
/** | ||
* Store a newly created resource in storage. | ||
* | ||
* @param \App\Http\Requests\WebApp\Contact\CreateContactGroupRequest $request | ||
* @return \Illuminate\Http\JsonResponse | ||
*/ | ||
public function store(CreateContactGroupRequest $request) | ||
{ | ||
return parent::save($request); | ||
} | ||
|
||
/** | ||
* Update the specified resource in storage. | ||
* | ||
* @param \App\Http\Requests\WebApp\Contact\UpdateContactGroupRequest $request | ||
* @param int $id | ||
* @return \Illuminate\Http\JsonResponse | ||
*/ | ||
public function update(UpdateContactGroupRequest $request, int $id) | ||
{ | ||
return parent::patch($request, $id); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
app/Http/Requests/WebApp/Contact/CreateContactGroupRequest.php
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,42 @@ | ||
<?php | ||
|
||
namespace App\Http\Requests\WebApp\Contact; | ||
|
||
use Illuminate\Foundation\Http\FormRequest; | ||
|
||
class CreateContactGroupRequest extends FormRequest | ||
{ | ||
/** | ||
* Determine if the user is authorized to make this request. | ||
*/ | ||
public function authorize(): bool | ||
{ | ||
return true; | ||
} | ||
|
||
/** | ||
* Get the validation rules that apply to the request. | ||
* | ||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string> | ||
*/ | ||
public function rules(): array | ||
{ | ||
return [ | ||
'business_entity_id' => ['required'], | ||
'name' => ['required', 'max:255'], | ||
]; | ||
} | ||
|
||
/** | ||
* Get custom attributes for validator errors. | ||
* | ||
* @return array<string, string> | ||
*/ | ||
public function attributes(): array | ||
{ | ||
return [ | ||
'business_entity_id' => trans('validation.attributes.business_entity'), | ||
'name' => trans('validation.attributes.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
42 changes: 42 additions & 0 deletions
42
app/Http/Requests/WebApp/Contact/UpdateContactGroupRequest.php
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,42 @@ | ||
<?php | ||
|
||
namespace App\Http\Requests\WebApp\Contact; | ||
|
||
use Illuminate\Foundation\Http\FormRequest; | ||
|
||
class UpdateContactGroupRequest extends FormRequest | ||
{ | ||
/** | ||
* Determine if the user is authorized to make this request. | ||
*/ | ||
public function authorize(): bool | ||
{ | ||
return true; | ||
} | ||
|
||
/** | ||
* Get the validation rules that apply to the request. | ||
* | ||
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string> | ||
*/ | ||
public function rules(): array | ||
{ | ||
return [ | ||
'business_entity_id' => ['required'], | ||
'name' => ['required', 'max:255'], | ||
]; | ||
} | ||
|
||
/** | ||
* Get custom attributes for validator errors. | ||
* | ||
* @return array<string, string> | ||
*/ | ||
public function attributes(): array | ||
{ | ||
return [ | ||
'business_entity_id' => trans('validation.attributes.business_entity'), | ||
'name' => trans('validation.attributes.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
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\Repositories; | ||
|
||
use App\Models\ContactGroup; | ||
use App\Repositories\Interfaces\ContactGroupRepositoryInterface; | ||
|
||
class ContactGroupRepository extends BaseResourceRepository implements ContactGroupRepositoryInterface | ||
{ | ||
/** | ||
* Create a new repository instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct() | ||
{ | ||
$this->model = new ContactGroup(); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
app/Repositories/Interfaces/ContactGroupRepositoryInterface.php
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,5 @@ | ||
<?php | ||
|
||
namespace App\Repositories\Interfaces; | ||
|
||
interface ContactGroupRepositoryInterface extends BaseResourceRepositoryInterface {} |
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 App\Services\Contact; | ||
|
||
use App\Repositories\Interfaces\ContactGroupRepositoryInterface; | ||
use App\Services\BaseResourceService; | ||
|
||
class ContactGroupService extends BaseResourceService | ||
{ | ||
/** | ||
* Create a new service instance. | ||
* | ||
* @param \App\Repositories\Interfaces\ContactGroupRepositoryInterface $repository | ||
* @return void | ||
*/ | ||
public function __construct(ContactGroupRepositoryInterface $repository) | ||
{ | ||
$this->repository = $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
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