Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions src/Http/Controllers/Api/ApiController.php

This file was deleted.

6 changes: 4 additions & 2 deletions src/Http/Controllers/Api/ApiDashboardFiltersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

namespace Code16\Sharp\Http\Controllers\Api;

class ApiDashboardFiltersController extends ApiController
use Code16\Sharp\Http\Controllers\Controller;

class ApiDashboardFiltersController extends Controller
{
public function store(string $globalFilter, string $dashboardKey)
{
$this->authorizationManager->check('entity', $dashboardKey);

$dashboard = $this->getDashboardInstance($dashboardKey);
$dashboard = $this->entityManager->entityFor($dashboardKey)->getViewOrFail();
$dashboard->buildDashboardConfig();

$dashboard->filterContainer()
Expand Down
9 changes: 5 additions & 4 deletions src/Http/Controllers/Api/ApiEntityListController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
use Code16\Sharp\EntityList\SharpEntityList;
use Code16\Sharp\Exceptions\SharpInvalidEntityKeyException;
use Code16\Sharp\Exceptions\SharpMethodNotImplementedException;
use Code16\Sharp\Http\Controllers\Controller;

class ApiEntityListController extends ApiController
class ApiEntityListController extends Controller
{
/**
* Reorder instances.
Expand All @@ -15,7 +16,7 @@ public function update(string $globalFilter, string $entityKey)
{
$this->authorizationManager->check('entity', $entityKey);

$list = $this->getListInstance($entityKey);
$list = $this->entityManager->entityFor($entityKey)->getListOrFail();
$list->buildListConfig();

$list->reorderHandler()->reorder(request('instances'));
Expand All @@ -32,14 +33,14 @@ public function delete(string $globalFilter, string $entityKey, string $instance
{
$this->authorizationManager->check('delete', $entityKey, $instanceId);

$list = $this->getListInstance($entityKey);
$list = $this->entityManager->entityFor($entityKey)->getListOrFail();
$list->initQueryParams(request()->query());

if (self::isDeleteMethodImplementedInConcreteClass($list)) {
$list->delete($instanceId);
} else {
try {
$show = $this->getShowInstance($entityKey);
$show = $this->entityManager->entityFor($entityKey)->getShowOrFail();
$show->delete($instanceId);
} catch (SharpInvalidEntityKeyException $ex) {
// No Show Page implementation was defined for this entity
Expand Down
6 changes: 4 additions & 2 deletions src/Http/Controllers/Api/ApiEntityListFiltersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

namespace Code16\Sharp\Http\Controllers\Api;

class ApiEntityListFiltersController extends ApiController
use Code16\Sharp\Http\Controllers\Controller;

class ApiEntityListFiltersController extends Controller
{
public function store(string $globalFilter, string $entityKey)
{
$this->authorizationManager->check('entity', $entityKey);

$list = $this->getListInstance($entityKey);
$list = $this->entityManager->entityFor($entityKey)->getListOrFail();
$list->buildListConfig();

$list->filterContainer()
Expand Down
3 changes: 2 additions & 1 deletion src/Http/Controllers/Api/ApiFilterAutocompleteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
namespace Code16\Sharp\Http\Controllers\Api;

use Code16\Sharp\Filters\AutocompleteRemoteFilter;
use Code16\Sharp\Http\Controllers\Controller;
use Code16\Sharp\Utils\Entities\SharpDashboardEntity;
use Code16\Sharp\Utils\Entities\ValueObjects\EntityKey;

class ApiFilterAutocompleteController extends ApiController
class ApiFilterAutocompleteController extends Controller
{
public function index(string $globalFilter, EntityKey $entityKey, string $filterHandlerKey): array
{
Expand Down
3 changes: 2 additions & 1 deletion src/Http/Controllers/Api/ApiFormAutocompleteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@

use Code16\Sharp\Exceptions\SharpInvalidConfigException;
use Code16\Sharp\Form\Fields\SharpFormAutocompleteRemoteField;
use Code16\Sharp\Http\Controllers\Controller;
use Code16\Sharp\Utils\Entities\ValueObjects\EntityKey;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Route;

class ApiFormAutocompleteController extends ApiController
class ApiFormAutocompleteController extends Controller
{
use HandlesFieldContainer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
namespace Code16\Sharp\Http\Controllers\Api;

use Code16\Sharp\Http\Controllers\Api\Requests\EditorUploadFormRequest;
use Code16\Sharp\Http\Controllers\Controller;

class ApiFormEditorUploadFormController extends ApiController
class ApiFormEditorUploadFormController extends Controller
{
public function update(string $globalFilter, EditorUploadFormRequest $request, string $entityKey, ?string $instanceId = null)
{
Expand Down
3 changes: 2 additions & 1 deletion src/Http/Controllers/Api/ApiFormRefreshController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

namespace Code16\Sharp\Http\Controllers\Api;

use Code16\Sharp\Http\Controllers\Controller;
use Code16\Sharp\Utils\Entities\ValueObjects\EntityKey;

class ApiFormRefreshController extends ApiController
class ApiFormRefreshController extends Controller
{
use HandlesFieldContainer;

Expand Down
3 changes: 2 additions & 1 deletion src/Http/Controllers/Api/ApiFormUploadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

use Code16\Sharp\Exceptions\SharpInvalidConfigException;
use Code16\Sharp\Form\Fields\SharpFormEditorField;
use Code16\Sharp\Http\Controllers\Controller;
use Code16\Sharp\Utils\Entities\ValueObjects\EntityKey;
use Code16\Sharp\Utils\FileUtil;
use Illuminate\Foundation\Validation\ValidatesRequests;

class ApiFormUploadController extends ApiController
class ApiFormUploadController extends Controller
{
use HandlesFieldContainer;
use ValidatesRequests;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
namespace Code16\Sharp\Http\Controllers\Api;

use Code16\Sharp\Form\Eloquent\Uploads\Traits\UsesSharpUploadModel;
use Code16\Sharp\Http\Controllers\Controller;

class ApiFormUploadThumbnailController extends ApiController
class ApiFormUploadThumbnailController extends Controller
{
use UsesSharpUploadModel;

Expand Down
3 changes: 2 additions & 1 deletion src/Http/Controllers/Api/ApiSearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
namespace Code16\Sharp\Http\Controllers\Api;

use Code16\Sharp\Data\SearchResultSetData;
use Code16\Sharp\Http\Controllers\Controller;
use Code16\Sharp\Search\SearchResultSet;
use Code16\Sharp\Utils\StringUtil;

class ApiSearchController extends ApiController
class ApiSearchController extends Controller
{
public function index(string $globalFilter)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
namespace Code16\Sharp\Http\Controllers\Api\Commands;

use Code16\Sharp\Data\Commands\CommandFormData;
use Code16\Sharp\Http\Controllers\Api\ApiController;
use Code16\Sharp\Http\Controllers\Controller;
use Code16\Sharp\Utils\Uploads\SharpUploadManager;

class ApiDashboardCommandController extends ApiController
class ApiDashboardCommandController extends Controller
{
use HandlesCommandForm;
use HandlesCommandResult;
Expand All @@ -20,7 +20,7 @@ public function __construct(

public function show(string $globalFilter, string $entityKey, string $commandKey)
{
$dashboard = $this->getDashboardInstance($entityKey);
$dashboard = $this->entityManager->entityFor($entityKey)->getViewOrFail();
$dashboard->buildDashboardConfig();
$dashboard->initQueryParams(request()->query());

Expand All @@ -35,7 +35,7 @@ public function show(string $globalFilter, string $entityKey, string $commandKey

public function update(string $globalFilter, string $entityKey, string $commandKey)
{
$dashboard = $this->getDashboardInstance($entityKey);
$dashboard = $this->entityManager->entityFor($entityKey)->getViewOrFail();
$dashboard->buildDashboardConfig();
$dashboard->initQueryParams(request()->input('query'));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
namespace Code16\Sharp\Http\Controllers\Api\Commands;

use Code16\Sharp\Data\Commands\CommandFormData;
use Code16\Sharp\Http\Controllers\Api\ApiController;
use Code16\Sharp\Http\Controllers\Controller;
use Code16\Sharp\Utils\Uploads\SharpUploadManager;

class ApiEntityListEntityCommandController extends ApiController
class ApiEntityListEntityCommandController extends Controller
{
use HandlesCommandForm;
use HandlesCommandResult;
Expand All @@ -20,7 +20,7 @@ public function __construct(

public function show(string $globalFilter, string $entityKey, string $commandKey)
{
$list = $this->getListInstance($entityKey);
$list = $this->entityManager->entityFor($entityKey)->getListOrFail();
$list->buildListConfig();
$list->initQueryParams(request()->query());

Expand All @@ -35,7 +35,7 @@ public function show(string $globalFilter, string $entityKey, string $commandKey

public function update(string $globalFilter, string $entityKey, string $commandKey)
{
$list = $this->getListInstance($entityKey);
$list = $this->entityManager->entityFor($entityKey)->getListOrFail();
$list->buildListConfig();
$list->initQueryParams(request()->input('query'));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
namespace Code16\Sharp\Http\Controllers\Api\Commands;

use Code16\Sharp\Exceptions\Auth\SharpAuthorizationException;
use Code16\Sharp\Http\Controllers\Api\ApiController;
use Code16\Sharp\Http\Controllers\Controller;

class ApiEntityListEntityStateController extends ApiController
class ApiEntityListEntityStateController extends Controller
{
use HandlesCommandResult;
use HandlesInstanceCommand;

public function update(string $globalFilter, string $entityKey, mixed $instanceId)
{
$list = $this->getListInstance($entityKey);
$list = $this->entityManager->entityFor($entityKey)->getListOrFail();
$list->buildListConfig();
$list->initQueryParams(request()->input('query'));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
namespace Code16\Sharp\Http\Controllers\Api\Commands;

use Code16\Sharp\Data\Commands\CommandFormData;
use Code16\Sharp\Http\Controllers\Api\ApiController;
use Code16\Sharp\Http\Controllers\Controller;
use Code16\Sharp\Utils\Uploads\SharpUploadManager;

class ApiEntityListInstanceCommandController extends ApiController
class ApiEntityListInstanceCommandController extends Controller
{
use HandlesCommandForm;
use HandlesCommandResult;
Expand All @@ -20,7 +20,7 @@ public function __construct(

public function show(string $globalFilter, string $entityKey, string $commandKey, mixed $instanceId)
{
$list = $this->getListInstance($entityKey);
$list = $this->entityManager->entityFor($entityKey)->getListOrFail();
$list->buildListConfig();
$list->initQueryParams(request()->query());

Expand All @@ -38,7 +38,7 @@ public function show(string $globalFilter, string $entityKey, string $commandKey
*/
public function update(string $globalFilter, string $entityKey, string $commandKey, mixed $instanceId)
{
$list = $this->getListInstance($entityKey);
$list = $this->entityManager->entityFor($entityKey)->getListOrFail();
$list->buildListConfig();
$list->initQueryParams(request()->input('query'));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@
namespace Code16\Sharp\Http\Controllers\Api\Commands;

use Code16\Sharp\Data\Commands\CommandFormData;
use Code16\Sharp\Http\Controllers\Api\ApiController;
use Code16\Sharp\Http\Controllers\Controller;
use Code16\Sharp\Utils\Entities\ValueObjects\EntityKey;
use Code16\Sharp\Utils\Uploads\SharpUploadManager;

class ApiEntityListQuickCreationCommandController extends ApiController
class ApiEntityListQuickCreationCommandController extends Controller
{
use HandlesCommandForm;
use HandlesCommandResult;

public function __construct(private readonly SharpUploadManager $uploadManager)
{
public function __construct(
private readonly SharpUploadManager $uploadManager,
) {
parent::__construct();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
namespace Code16\Sharp\Http\Controllers\Api\Commands;

use Code16\Sharp\Exceptions\Auth\SharpAuthorizationException;
use Code16\Sharp\Http\Controllers\Api\ApiController;
use Code16\Sharp\Http\Controllers\Controller;
use Code16\Sharp\Show\SharpSingleShow;

class ApiShowEntityStateController extends ApiController
class ApiShowEntityStateController extends Controller
{
use HandlesCommandResult;
use HandlesInstanceCommand;
Expand All @@ -33,7 +33,7 @@ public function update(string $globalFilter, string $entityKey, mixed $instanceI

private function getShowPage(string $entityKey, mixed $instanceId = null)
{
$showPage = $this->getShowInstance($entityKey);
$showPage = $this->entityManager->entityFor($entityKey)->getShowOrFail();

abort_if(
(! $instanceId && ! $showPage instanceof SharpSingleShow)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
namespace Code16\Sharp\Http\Controllers\Api\Commands;

use Code16\Sharp\Data\Commands\CommandFormData;
use Code16\Sharp\Http\Controllers\Api\ApiController;
use Code16\Sharp\Http\Controllers\Controller;
use Code16\Sharp\Show\SharpSingleShow;
use Code16\Sharp\Utils\Uploads\SharpUploadManager;

class ApiShowInstanceCommandController extends ApiController
class ApiShowInstanceCommandController extends Controller
{
use HandlesCommandForm;
use HandlesCommandResult;
Expand Down Expand Up @@ -45,7 +45,7 @@ public function update(string $globalFilter, string $entityKey, string $commandK

private function getShowPage(string $entityKey, mixed $instanceId = null)
{
$showPage = $this->getShowInstance($entityKey);
$showPage = $this->entityManager->entityFor($entityKey)->getShowOrFail();

abort_if(
(! $instanceId && ! $showPage instanceof SharpSingleShow)
Expand Down
3 changes: 2 additions & 1 deletion src/Http/Controllers/Api/DownloadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

namespace Code16\Sharp\Http\Controllers\Api;

use Code16\Sharp\Http\Controllers\Controller;
use Illuminate\Support\Facades\Storage;

class DownloadController extends ApiController
class DownloadController extends Controller
{
public function show(string $globalFilter, string $entityKey, ?string $instanceId = null)
{
Expand Down
5 changes: 1 addition & 4 deletions src/Http/Controllers/Api/Embeds/ApiEmbedsFormController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@

namespace Code16\Sharp\Http\Controllers\Api\Embeds;

use Code16\Sharp\Auth\SharpAuthorizationManager;
use Code16\Sharp\Data\Embeds\EmbedFormData;
use Illuminate\Routing\Controller;
use Code16\Sharp\Http\Controllers\Controller;

class ApiEmbedsFormController extends Controller
{
use HandlesEmbed;

public function __construct(private readonly SharpAuthorizationManager $authorizationManager) {}

public function show(string $globalFilter, string $embedKey, string $entityKey, ?string $instanceId = null)
{
if ($instanceId) {
Expand Down
Loading
Loading