Pagemanager Controller - Custom Field Controller Method #656
-
In order to get the Image upload field to do what I need I've created a custom image field. Unfortunately, I'm having a difficult time understanding where I process the logic for the field after the page form is submitted. I've attempted to add an update method to the PageCrudController but that doesn't do what I expect. I need to know how to handle fields after a form is submitted. Right now I only have a custom_image.blade.php view. Any direction would be appreciated, thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey @ericjanofski To run a custom logic after the page form is submitted. You don't need a custom view. Let's see how to customize form submission on
<?php
namespace App\Http\Controllers\Admin;
use Backpack\PageManager\app\Http\Controllers\Admin\PageCrudController as CrudController;
class PageCrudController extends CrudController
{
use \Backpack\CRUD\app\Http\Controllers\Operations\CreateOperation { store as traitStore; }
use \Backpack\CRUD\app\Http\Controllers\Operations\UpdateOperation { update as traitUpdate; }
public function store(){
// do something before validation, before save, before everything
$response = $this->traitStore();
// do something after save
return $response;
}
public function update(){
// do something before validation, before save, before everything
$response = $this->traitUpdate();
// do something after save
return $response;
}
} |
Beta Was this translation helpful? Give feedback.
Hey @ericjanofski
To run a custom logic after the page form is submitted. You don't need a custom view.
And... If it's something else you can have it.
Let's see how to customize form submission on
PageCrudController
of Pagemanager.app/Http/Controllers/Admin/PageCrudController.php
Backpack\PageManager\app\Http\Controllers\Admin\PageCrudController
Route::crud('page', 'PageCrudController');
inroutes/backpack/custom.php