agelxnash/mod-laravel
Configuration
You will want to run the following command to publish the config to your application, otherwise it will be overwritten when the package is updated.
php artisan vendor:publish --provider="AgelxNash\modLaravel\ServiceProvider"
Now you can edit the file config/modx.php
Usage
Create your snippet in the config file config/modx.php
return array(
'snippets' => array(
'user' => function($params){
$id = isset($params['id']) ? (int)$params['id'] : 0;
$field = (isset($params['field']) && in_array($params['field'], array('name', 'email'))) ? (string)$params['field'] : 'name';
$userObj = App\Models\User::findOrNew($id);
return $userObj->{$field};
}
)
);
Now you can call a snippet user
$text = 'Some data: [[example? &id=`asd`]]. User: [[user? &id=`2`]]';
return Modx::mergeSnippets($text);
As a result, you get something like this
Some data: Array ( [id] => asd ). User: Admin
Attention
Do not get carried away with this garbage. It is absolutely safe and can lead to cracking of your site.
Why You Need
For example, you have a slider. And you want to insert it in any place
See
Related Packages
rectitude-open/filament-site-snippets
A Filament plugin for easily managing content snippets like text, rich text, or...
494
1
ribrit/installers
A multi-framework Composer library installer
65
0
agl
aimeos
annotatecms
attogram
bitrix
cakephp
chef
cockpit
codeigniter
concrete5
craft
croogo
dokuwiki
dolibarr
drupal
elgg
eliasis
expressionengine
ez platform
fuelphp
grav
hurad
imagecms
installer
itop
joomla
kanboard
kohana
lan management system
laravel
lavalite
lithium
magento
majima
mako
mautic
maya
mediawiki
modulework
modx
modx evo
moodle
osclass
oxid
phpbb
piwik
plentymarkets
porto
ppi
puppet
pxcms
radphp
reindex
roundcube
shopware
silverstripe
smf
sydes
symfony
thelia
typo3
wolfcms
wordpress
yawik
zend
zikula
composer/installers
A multi-framework Composer library installer
146,545,619
1,441
agl
annotatecms
attogram
bitrix
cakephp
chef
cockpit
codeigniter
concrete5
concretecms
croogo
dokuwiki
dolibarr
drupal
elgg
eliasis
expressionengine
ez platform
fuelphp
grav
hurad
imagecms
installer
itop
kanboard
known
kohana
lan management system
laravel
lavalite
lithium
magento
majima
mako
mantisbt
matomo
mautic
maya
mediawiki
miaoxing
modulework
modx
modx evo
moodle
osclass
oxid
pantheon
phpbb
piwik
plentymarkets
porto
ppi
processwire
puppet
pxcms
radphp
reindex
roundcube
shopware
silverstripe
smf
starbug
sydes
sylius
tastyigniter
thelia
whmcs
wolfcms
wordpress
yawik
zend
zikula
vlados/laravel-blade-crawler-detect
Boost Lighthouse and PageSpeed scores by hiding cookie banners, chat widgets and...
5,439
0