Custom

Hello i got a user basic user table from laravel and admin user of twill i want to add crud for the normal user in the twill dashboard but still keep the twill admin user alonside it i try to transform the basic laravel module in one of a module i created a User controller in the Controller/Twill but the routing redirect me to the twill user module
9 Replies
magius
magiusOP3w ago
yeah but dont want to add the profile overhead it just add a step i am more near a workable solution now i renamed the absic laravel user table to account and tried to transform it to account module for a account module
ifox
ifox3w ago
Alright, then you can call your twill module something like AppUsers, and in the repository you use your user model instead of a twill generated model or rename the entire thing yeah, probably easier
magius
magiusOP3w ago
its okay my account controller display can display now. But i needed to add a deleted_at column for the soft_delete.
No description
magius
magiusOP3w ago
the data arent displaying normally and i cant seem to find the prob when i compare to other module
php
<?php

namespace App\Http\Controllers\Twill;

use A17\Twill\Models\Contracts\TwillModelContract;
use A17\Twill\Services\Listings\Columns\Text;
use A17\Twill\Services\Listings\TableColumns;
use A17\Twill\Services\Forms\Fields\Input;
use A17\Twill\Services\Forms\Fields\Medias;
use A17\Twill\Services\Forms\Fields\Wysiwyg;
use A17\Twill\Services\Forms\Fieldset;
use A17\Twill\Services\Forms\Form;
use A17\Twill\Http\Controllers\Admin\ModuleController as BaseModuleController;

class AccountController extends BaseModuleController
{
protected $moduleName = 'accounts';
protected function setUpController(): void
{

}

}
php
<?php

namespace App\Http\Controllers\Twill;

use A17\Twill\Models\Contracts\TwillModelContract;
use A17\Twill\Services\Listings\Columns\Text;
use A17\Twill\Services\Listings\TableColumns;
use A17\Twill\Services\Forms\Fields\Input;
use A17\Twill\Services\Forms\Fields\Medias;
use A17\Twill\Services\Forms\Fields\Wysiwyg;
use A17\Twill\Services\Forms\Fieldset;
use A17\Twill\Services\Forms\Form;
use A17\Twill\Http\Controllers\Admin\ModuleController as BaseModuleController;

class AccountController extends BaseModuleController
{
protected $moduleName = 'accounts';
protected function setUpController(): void
{

}

}
ifox
ifox3w ago
Do you have a title column? If not you can use $this->setTitleColumnKey('your-column') inside setUpController
magius
magiusOP3w ago
yeh it worked for the name thx now the next step: - its how to display the plain password and not the hashed version from the Bdd - and when i update this password and save he get hashed again before saving
ifox
ifox3w ago
Hashing is a one way process, you cannot get the password out of the hashed version. This would be a major security concern. You can certainly allow setting a new password from the CMS, but not display it in clear text. imagine if every company could get your passwords out of their database. We hash passwords before saving them so that it just isn't possible.
magius
magiusOP3w ago
so for hashing should i use the beforeSave with the repositiory? or their is something i can put on the
public function getForm(TwillModelContract $model): Form
{
$form = parent::getForm($model);
$form->add(
Input::make()
->name('name')
->label('Name')
->maxLength(160),
);
$form->add(
Input::make()
->name('email')
->label('Email')

);
$form->add(
Input::make()
->name('password')
->label('Password')
->type('password')

);
return $form;
}
public function getForm(TwillModelContract $model): Form
{
$form = parent::getForm($model);
$form->add(
Input::make()
->name('name')
->label('Name')
->maxLength(160),
);
$form->add(
Input::make()
->name('email')
->label('Email')

);
$form->add(
Input::make()
->name('password')
->label('Password')
->type('password')

);
return $form;
}
Want results from more Discord servers?
Add your server