mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/izyim.git
synced 2026-08-26 07:53:56 +00:00
Cleaned-BackEnd-Contact
This commit is contained in:
@@ -1,53 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Contacts;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Resources\Contact as ContactResource;
|
||||
use App\Classes\Constants;
|
||||
use App\Classes\ControllersLogic\Contacts\ListContacts;
|
||||
use App\Classes\ControllersLogic\Contacts\UpdateContact;
|
||||
use App\Classes\ControllersLogic\Contacts\DeleteContact;
|
||||
|
||||
class ContactController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @param string $type
|
||||
* @param string $reference
|
||||
* @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection
|
||||
*/
|
||||
public function index(string $type, string $reference) {
|
||||
|
||||
return (new ListContacts())->execute(Constants::MODULE_TYPES[$type], $reference);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param string $type
|
||||
* @param string $reference
|
||||
* @return ContactResource
|
||||
*/
|
||||
public function store(Request $request, string $type, string $reference)
|
||||
{
|
||||
return (new UpdateContact())->execute($request, Constants::MODULE_TYPES[$type], $reference);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
* @return ContactResource
|
||||
*/
|
||||
public function destroy(string $id): ContactResource {
|
||||
|
||||
return (new DeleteContact())->execute($id);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ use App\Classes\Modules\ControllerLogic\Contacts\CreateContactLogic;
|
||||
class CreateContactController
|
||||
{
|
||||
public function create(string $type, int $referencesId, Request $request, CreateContactLogic $logic){
|
||||
|
||||
return $logic->execute(Constants::MODULE_TYPES[$type], $referencesId, $request);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: user
|
||||
* Date: 09/05/2019
|
||||
* Time: 11:51 AM
|
||||
*/
|
||||
|
||||
namespace App\Http\Controllers\Contacts;
|
||||
|
||||
use App\Modules\ControllerLogic\Contacts\DeleteContactLogic;
|
||||
|
||||
class DeleteContactController
|
||||
{
|
||||
public function destroy(String $id, DeleteContactLogic $logic ){
|
||||
return $logic->execute($id);
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,6 @@
|
||||
|
||||
namespace App\Http\Controllers\Contacts;
|
||||
|
||||
|
||||
|
||||
use App\Modules\ControllerLogic\Contacts\ListContactLogic;
|
||||
|
||||
|
||||
|
||||
@@ -9,13 +9,15 @@
|
||||
namespace App\Http\Controllers\Contacts;
|
||||
|
||||
|
||||
use App\Classes\Constants;
|
||||
use App\Modules\ControllerLogic\Contacts\UpdateContactLogic;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UpdateContactController
|
||||
{
|
||||
public function update(int $id,Request $request, UpdateContactLogic $logic){
|
||||
return $logic->execute($id, $request);
|
||||
public function update(string $type, string $referenceId, int $id, Request $request, UpdateContactLogic $logic){
|
||||
|
||||
return $logic->execute($id,$referenceId, Constants::MODULE_TYPES[$type], $request);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user