Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgergo committed Jan 7, 2024
1 parent 7104e0c commit 7962789
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 31 deletions.
4 changes: 1 addition & 3 deletions src/Fields/Field.php
Original file line number Diff line number Diff line change
Expand Up @@ -425,9 +425,7 @@ public function resolveFormat(Request $request, Model $model): ?string
*/
public function persist(Request $request, Model $model, mixed $value): void
{
$model->saving(function (Model $model) use ($request, $value): void {
$this->resolveHydrate($request, $model, $value);
});
$this->resolveHydrate($request, $model, $value);
}

/**
Expand Down
28 changes: 0 additions & 28 deletions src/Http/Controllers/ResourceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ class ResourceController extends Controller
*/
public function index(Request $request, Resource $resource): Response
{
if ($resource->getPolicy()) {
$this->authorize('viewAny', $resource->getModel());
}

$data = $resource->toIndex($request);

return ResponseFactory::view(
Expand All @@ -35,10 +31,6 @@ public function index(Request $request, Resource $resource): Response
*/
public function create(Request $request, Resource $resource): Response
{
if ($resource->getPolicy()) {
$this->authorize('create', $resource->getModel());
}

$data = $resource->toCreate($request);

return ResponseFactory::view(
Expand All @@ -51,10 +43,6 @@ public function create(Request $request, Resource $resource): Response
*/
public function store(Request $request, Resource $resource): RedirectResponse
{
if ($resource->getPolicy()) {
$this->authorize('create', $resource->getModel());
}

$model = $resource->getModelInstance();

$resource->handleFormRequest($request, $model);
Expand All @@ -68,10 +56,6 @@ public function store(Request $request, Resource $resource): RedirectResponse
*/
public function show(Request $request, Resource $resource, Model $model): Response
{
if ($resource->getPolicy()) {
$this->authorize('view', $model);
}

$data = $resource->toShow($request, $model);

return ResponseFactory::view(
Expand All @@ -84,10 +68,6 @@ public function show(Request $request, Resource $resource, Model $model): Respon
*/
public function edit(Request $request, Resource $resource, Model $model): Response
{
if ($resource->getPolicy()) {
$this->authorize('update', $model);
}

$data = $resource->toEdit($request, $model);

return ResponseFactory::view(
Expand All @@ -100,10 +80,6 @@ public function edit(Request $request, Resource $resource, Model $model): Respon
*/
public function update(Request $request, Resource $resource, Model $model): RedirectResponse
{
if ($resource->getPolicy()) {
$this->authorize('update', $model);
}

$resource->handleFormRequest($request, $model);

return Redirect::to($resource->modelUrl($model))
Expand Down Expand Up @@ -132,10 +108,6 @@ public function destroy(Request $request, Resource $resource, Model $model): Red
*/
public function restore(Request $request, Resource $resource, Model $model): RedirectResponse
{
if ($resource->getPolicy()) {
$this->authorize('restore', $model);
}

$model->restore();

return Redirect::back()
Expand Down

0 comments on commit 7962789

Please sign in to comment.