Hi, I wanted to make some changes to the Sprunje that handles the user table in order to change the sortable items. (I want to have first_name and last_name in different columns and sort by them and not by the whole name and/or username)
I thought about ovverriding it, is there a way to override that Sprunje?
I tried to
-
make
MyUserSprunje
copyingUserSprunje
and making the changes I wanted -
then made a new controller
MyUserController
that extendsUserController
with a newgetList
method, changing this line
$sprunje = $classMapper->createInstance('user_sprunje', $classMapper, $params);
to
$sprunje = $classMapper->createInstance('
my_user_sprunje', $classMapper, $params);
-
and then mapped the new class inside the ServicesProvider
$container->extend('classMapper', function ($classMapper, $c) { $classMapper->setClassMapping('my_user_sprunje', 'UserFrosting\Sprinkle\Site\Sprunje\MyUserSprunje'); return $classMapper; });
However the default UserSprunje
is still the one in charge when I visualize the table.
I know that MyUserSprunje
works because it does if I place it in the Admin Sprinkle, as you may guess I do not want to make changes to the 3 base Sprinkles.
I’m new to UF and to web development so I’m not sure this is the right approach. If anyone could give some hints I’d be very grateful.