setup from the crud controller made by backpack
public function setup()
{
CRUD::setModel(AppModelsWebServicesCartBackendQuotesDetails::class);
CRUD::setRoute(config('backpack.base.route_prefix') . '/cart');
CRUD::setEntityNameStrings('Quotes', 'Carrito: Quotes Details');
$opertion = $this->crud->getOperation();
Log::info('Current Operation: ' . $opertion);
if (
!Auth::user()->hasPermissionTo($opertion) or
!Auth::user()->hasPermissionTo('cart')
) {
Alert::error('Unauthorized access - you do not have the necessary permissions to see this page.')->flash();
$this->crud->denyAccess([$opertion]);
}
}
this function should work as a data edit
public function editLinkify($id)
{
$this->crud->setOperation('editLinkify');
$opertion = $this->crud->getOperation();
Log::info('Current Operation ed: ' . $opertion);
$quoteDetail = QuotesDetails::findOrFail($id);
$quote = DB::connection('cart')->table('quote')->where('id', $quoteDetail->id)->first();
// Verifica si se encontró un registro en la tabla quote
$b_account_rut = $quote ? $quote->b_account_rut : null;
return view('ModuleQuoteDetails.Summary.edit', compact('quoteDetail', 'b_account_rut'));
}
route
Route::get('cart/{id}/edit-linkify', 'WebServicesCartBackendQuotesDetailsQuotesDetailsCrudController@editLinkify')
->name('cart.edit-linkify');
button
@if ($crud->hasAccess('update', $entry))
<a href="{{ url($crud->route . '/' . $entry->getKey() . '/edit-linkify') }}" class="btn btn-sm btn-link">
<i class="la la-edit"></i> Edit linkify
</a>
@endif
What I am getting in both the setup and function logs is empty when I click my button.
It is not the case if I go to edit which is part of backpack, there I do get an update log
something in setup() is messing with my new buttom i think is this:
$opertion = $this->crud->getOperation();
this one in the edit method did nothing :
$this->crud->setOperation(‘editLinkify’);
docs:
https://backpackforlaravel.com/docs/6.x/crud-buttons#adding-a-custom-button-with-a-blade-file-1
I want to ensure that my button delivers the update or edit-linkify operation, rather, that it does not arrive empty, since my setup() if condition throws an error when an empty operation arrives
Rodrigo Castro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.