1. Go to this page and download the library: Download j0hnys/trident library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
namespace App\Http\Controllers\Trident;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Container\Container as App;
use App\Trident\Workflows\Validations\StoreRequest;
use App\Trident\Interfaces\Workflows\Logic\TestEntityInterface as TestEntityWorkflow;
use App\Trident\Interfaces\Workflows\Repositories\TestEntityRepositoryInterface as TestEntityRepository;
use App\Trident\Workflows\Exceptions\TestEntityException;
use App\Trident\Workflows\Schemas\Logic\TestEntity\Typed\StructStoreTestEntity;
class TestEntityController extends Controller
{
protected $TestEntity;
public function __construct(TestEntityWorkflow $test_entity_workflow, TestEntityRepository $test_entity_repository)
{
$this->test_entity_workflow = $test_entity_workflow;
$this->test_entity_repository = $test_entity_repository;
}
public function store(TestEntityStoreRequest $test_entity_store_request)
{
$this->authorize('store',$this->test_entity_restful_crud_repository);
$struct_store_test_entity = new StructStoreTestEntity( $test_entity_store_request->all() );
$test_entity_resource = $this->test_entity_workflow->store($struct_store_test_entity);
return response()->json( $test_entity_resource );
}
}
namespace App\Trident\Workflows\Logic;
use Illuminate\Http\Request;
use App\Trident\Workflows\Exceptions\TestEntityException;
use App\Trident\Interfaces\Workflows\Repositories\TestEntityRepositoryInterface as TestEntityRepository;
use App\Trident\Interfaces\Workflows\Logic\TestEntityInterface;
use App\Trident\Interfaces\Business\Logic\TestEntityInterface as TestEntityBusiness;
use App\Trident\Workflows\Schemas\Logic\TestEntity\Typed\StructStoreTestEntity;
use App\Trident\Workflows\Schemas\Logic\TestEntity\Resources\TestEntityResource;
class TestEntity implements TestEntityInterface
{
protected $test_entity_repository;
public function __construct(TestEntityBusiness $test_entity_business, TestEntityRepository $test_entity_repository)
{
$this->test_entity_repository = $test_entity_repository;
$this->test_entity_business = $test_entity_business;
}
public function store(StructStoreTestEntity $struct_store_test_entity): TestEntityResource
{
$data = $this->test_entity_business->addSuffix($struct_store_test_entity,'_edit');
$result = $this->test_entity_repository->create($data);
return $struct_store_test_entity->getReturnResource($result);
}
}
namespace App\Trident\Business\Logic;
use App\Trident\Business\Exceptions\TestEntityException;
use App\Trident\Interfaces\Business\Logic\TestEntityInterface;
use App\Trident\Workflows\Schemas\Logic\TestEntity\Typed\StructStoreTestEntity;
class TestEntity implements TestEntityInterface
{
public function addSuffix(StructStoreTestEntity $struct_store_test_entity, string $suffix): array
{
$data = $struct_store_test_entity->getFilledValues();
$data['username'] = $data['username'].$suffix;
return $data;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.