I have the Users Model extended and I need to add an ajaxHandler method to Users Controller.
Plugin.php
public function boot() {
UserModel::extend(function(UserModel $model){
$model->hasOne['paypal'] = ['\PlanetaDelEste\PayPal\Models\User'];
});
UserModel::deleting(function($user) {
$user->paypal->delete();
});
UserController::extendFormFields(function($form, $model, $context){
if(!$model instanceof UserModel)
return;
if(!$model->exists)
return;
PaypalUser::getFromUser($model);
$form->addTabFields([
'paypal[transactions]' => [
'tab' => 'planetadeleste.paypal::lang.tab.transactions',
'type' => 'partial',
'path' => '$/planetadeleste/paypal/models/user/_transaction_list.htm'
]
// more fields...
]);
});
}
_transaction_list.htm
<h2>
<i class="fa fa-cc-paypal"></i> <?= e(trans('planetadeleste.paypal::lang.tab.transactions')) ?>
<a href="nojavascript...//" class="btn btn-default pull-right" data-request="onUpdateList"><?= e(trans('planetadeleste.paypal::lang.form.update_list')) ?></a>
</h2>
I don't know how to add the update_onUpdateList method to $/rainlab/user/controllers/Users.php Controller.
Any help?
thanks
Last updated