Helpers
Definition
A helper is a php function you can use in all your application, in both controllers and views.
Default helpers
ucdomain()
Retrieves a domain by id or slug.
use Uccello\Core\Models\Domain;
$domain = ucdomain(1);
echo $domain->name;
// => Uccello
echo ucdomain('uccello')->name;
// => Uccello
echo Domain::where('slug', 'uccello')->first()->name;
// => Uccelloucmodule()
Retrieves a module by id or name.
As Uccello cache the modules, please don't use ucmodule($moduleName) in your migration files. Your new created module could be not accessible with this helper.
Use Module::where('name', $moduleName)->first() instead.
uctrans()
Retrieves the complete prefix of a label and translated it. If the translation does not exist, it tries to find a default one according to priorities. If no translation exist, it displays only the label without translation.
Priority:
Translation overridden in app
Translation in package
Default translation overridden in app
Default translation in uccello
No translation
ucroute()
Retrieves a route and automatically adds domain and module params.
uclog()
Displays log data into Laravel Debug Bar.
uitype()
Retrieves an uitype by id or name.
displaytype()
Retrieves a display type by id or name.
capability()
Retrieves a capability by id or name.
ucasset()
Returns the complete path of an asset available in an external package.
ucattribute()
Returns a record attribute value. It is able to follow a complex path according to models definition (e.g. 'domain.parent.name'). If the attribute is not accessible, it returns null.
ucnotify()
Displays a flash info toast containing the message of your choice.
ucrecord()
Retrieves a record by id or uuid. If you want to retrieves a record by its id, you have to specify its model class two.
Last updated
Was this helpful?