first commit
This commit is contained in:
21
modules/Develop/Http/Controllers/GenerateController.php
Normal file
21
modules/Develop/Http/Controllers/GenerateController.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Develop\Http\Controllers;
|
||||
|
||||
use Catch\Base\CatchController as Controller;
|
||||
use Exception;
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\Develop\Support\Generate\Generator;
|
||||
|
||||
class GenerateController extends Controller
|
||||
{
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Generator $generator
|
||||
* @throws Exception
|
||||
*/
|
||||
public function index(Request $request, Generator $generator)
|
||||
{
|
||||
$generator->setParams($request->all())->generate();
|
||||
}
|
||||
}
|
91
modules/Develop/Http/Controllers/ModuleController.php
Normal file
91
modules/Develop/Http/Controllers/ModuleController.php
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Develop\Http\Controllers;
|
||||
|
||||
use Catch\Base\CatchController;
|
||||
use Catch\Support\Module\ModuleRepository;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class ModuleController extends CatchController
|
||||
{
|
||||
protected ModuleRepository $repository;
|
||||
|
||||
/**
|
||||
* @param ModuleRepository $repository
|
||||
*/
|
||||
public function __construct(ModuleRepository $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* index
|
||||
*
|
||||
* @param Request $request
|
||||
* @return Collection
|
||||
*/
|
||||
public function index(Request $request): Collection
|
||||
{
|
||||
return $this->repository->all($request->all());
|
||||
}
|
||||
|
||||
/**
|
||||
* store
|
||||
*
|
||||
* @param Request $request
|
||||
* @return bool|int
|
||||
*/
|
||||
public function store(Request $request): bool|int
|
||||
{
|
||||
return $this->repository->create($request->all());
|
||||
}
|
||||
|
||||
/**
|
||||
* show
|
||||
*
|
||||
* @param string $name
|
||||
* @return Collection
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function show(mixed $name): Collection
|
||||
{
|
||||
return $this->repository->show($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* update
|
||||
*
|
||||
* @param $name
|
||||
* @param Request $request
|
||||
* @return bool|int
|
||||
*/
|
||||
public function update($name, Request $request): bool|int
|
||||
{
|
||||
return $this->repository->update($name, $request->all());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* update
|
||||
*
|
||||
* @param $name
|
||||
* @return bool|int
|
||||
*/
|
||||
public function enable($name): bool|int
|
||||
{
|
||||
return $this->repository->disOrEnable($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* destroy
|
||||
*
|
||||
* @param $name
|
||||
* @return bool|int
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function destroy($name): bool|int
|
||||
{
|
||||
return $this->repository->delete($name);
|
||||
}
|
||||
}
|
61
modules/Develop/Http/Controllers/SchemaController.php
Normal file
61
modules/Develop/Http/Controllers/SchemaController.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Develop\Http\Controllers;
|
||||
|
||||
use Catch\Base\CatchController;
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\Develop\Models\Schemas;
|
||||
|
||||
/**
|
||||
* SchemaController
|
||||
*/
|
||||
class SchemaController extends CatchController
|
||||
{
|
||||
public function __construct(
|
||||
protected Schemas $schemas
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return $this->schemas->getList();
|
||||
}
|
||||
|
||||
/**
|
||||
* store
|
||||
*
|
||||
* @param Request $request
|
||||
* @throws \Exception
|
||||
* @return bool
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
return $this->schemas->storeBy($request->all());
|
||||
}
|
||||
|
||||
/**
|
||||
* show
|
||||
*
|
||||
* @param $id
|
||||
* @return mixed
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return $this->schemas->show($id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* destroy
|
||||
*
|
||||
* @param $id
|
||||
* @return bool|null
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
return $this->schemas->deleteBy($id);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user