code
stringlengths 31
1.39M
| docstring
stringlengths 23
16.8k
| func_name
stringlengths 1
126
| language
stringclasses 1
value | repo
stringlengths 7
63
| path
stringlengths 7
166
| url
stringlengths 50
220
| license
stringclasses 7
values |
---|---|---|---|---|---|---|---|
public function boot()
{
$this->loadViewsFrom( dirname( __DIR__ ) . '/views', 'shop' );
$this->loadRoutesFrom( dirname( __DIR__ ) . '/routes/aimeos.php' );
$this->publishes( [dirname( __DIR__ ) . '/config/shop.php' => config_path( 'shop.php' )], 'config' );
$this->publishes( [dirname( __DIR__ ) . '/public' => public_path( 'vendor/shop' )], 'public' );
$class = '\Composer\InstalledVersions';
if( class_exists( $class ) && method_exists( $class, 'getInstalledPackagesByType' ) )
{
foreach( \Composer\InstalledVersions::getInstalledPackagesByType( 'aimeos-extension' ) as $package )
{
$path = realpath( \Composer\InstalledVersions::getInstallPath( $package ) );
if( file_exists( $path . '/themes/client/html' ) ) {
$this->publishes( [$path . '/themes/client/html' => public_path( 'vendor/shop/themes' )], 'public' );
}
}
}
}
|
Bootstrap the application events.
@return void
|
boot
|
php
|
aimeos/aimeos-laravel
|
src/ShopServiceProvider.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/ShopServiceProvider.php
|
MIT
|
public function register()
{
$this->mergeConfigFrom( dirname( __DIR__ ) . '/config/default.php', 'shop' );
$this->app->scoped( 'aimeos', function( $app ) {
return new \Aimeos\Shop\Base\Aimeos( $app['config'] );
});
$this->app->scoped( 'aimeos.config', function( $app ) {
return new \Aimeos\Shop\Base\Config( $app['config'], $app['aimeos'] );
});
$this->app->scoped( 'aimeos.i18n', function( $app ) {
return new \Aimeos\Shop\Base\I18n( $this->app['config'], $app['aimeos'] );
});
$this->app->scoped( 'aimeos.locale', function( $app ) {
return new \Aimeos\Shop\Base\Locale( $app['config'] );
});
$this->app->scoped( 'aimeos.context', function( $app ) {
return new \Aimeos\Shop\Base\Context( $app['session.store'], $app['aimeos.config'], $app['aimeos.locale'], $app['aimeos.i18n'] );
});
$this->app->scoped( 'aimeos.support', function( $app ) {
return new \Aimeos\Shop\Base\Support( $app['aimeos.context'], $app['aimeos.locale'] );
});
$this->app->scoped( 'aimeos.view', function( $app ) {
return new \Aimeos\Shop\Base\View( $app['config'], $app['aimeos.i18n'], $app['aimeos.support'] );
});
$this->app->scoped( 'aimeos.shop', function( $app ) {
return new \Aimeos\Shop\Base\Shop( $app['aimeos'], $app['aimeos.context'], $app['aimeos.view'] );
});
$this->app->bind( 'aimeos.frontend.attribute', function( $app ) {
return \Aimeos\Controller\Frontend::create( $app['aimeos.context'], 'attribute' );
});
$this->app->bind( 'aimeos.frontend.basket', function( $app ) {
return \Aimeos\Controller\Frontend::create( $app['aimeos.context'], 'basket' );
});
$this->app->bind( 'aimeos.frontend.catalog', function( $app ) {
return \Aimeos\Controller\Frontend::create( $app['aimeos.context'], 'catalog' );
});
$this->app->bind( 'aimeos.frontend.cms', function( $app ) {
return \Aimeos\Controller\Frontend::create( $app['aimeos.context'], 'cms' );
});
$this->app->bind( 'aimeos.frontend.customer', function( $app ) {
return \Aimeos\Controller\Frontend::create( $app['aimeos.context'], 'customer' );
});
$this->app->bind( 'aimeos.frontend.locale', function( $app ) {
return \Aimeos\Controller\Frontend::create( $app['aimeos.context'], 'locale' );
});
$this->app->bind( 'aimeos.frontend.order', function( $app ) {
return \Aimeos\Controller\Frontend::create( $app['aimeos.context'], 'order' );
});
$this->app->bind( 'aimeos.frontend.product', function( $app ) {
return \Aimeos\Controller\Frontend::create( $app['aimeos.context'], 'product' );
});
$this->app->bind( 'aimeos.frontend.service', function( $app ) {
return \Aimeos\Controller\Frontend::create( $app['aimeos.context'], 'service' );
});
$this->app->bind( 'aimeos.frontend.stock', function( $app ) {
return \Aimeos\Controller\Frontend::create( $app['aimeos.context'], 'stock' );
});
$this->app->bind( 'aimeos.frontend.subscription', function( $app ) {
return \Aimeos\Controller\Frontend::create( $app['aimeos.context'], 'subscription' );
});
$this->app->bind( 'aimeos.frontend.supplier', function( $app ) {
return \Aimeos\Controller\Frontend::create( $app['aimeos.context'], 'supplier' );
});
$this->commands( array(
'Aimeos\Shop\Command\AccountCommand',
'Aimeos\Shop\Command\ClearCommand',
'Aimeos\Shop\Command\SetupCommand',
'Aimeos\Shop\Command\JobsCommand',
) );
}
|
Register the service provider.
@return void
|
register
|
php
|
aimeos/aimeos-laravel
|
src/ShopServiceProvider.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/ShopServiceProvider.php
|
MIT
|
public function provides()
{
return array(
'Aimeos\Shop\Base\Aimeos', 'Aimeos\Shop\Base\I18n', 'Aimeos\Shop\Base\Context',
'Aimeos\Shop\Base\Config', 'Aimeos\Shop\Base\Locale', 'Aimeos\Shop\Base\View',
'Aimeos\Shop\Base\Support', 'Aimeos\Shop\Base\Shop',
'Aimeos\Shop\Command\AccountCommand', 'Aimeos\Shop\Command\ClearCommand',
'Aimeos\Shop\Command\SetupCommand', 'Aimeos\Shop\Command\JobsCommand',
);
}
|
Get the services provided by the provider.
@return array
|
provides
|
php
|
aimeos/aimeos-laravel
|
src/ShopServiceProvider.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/ShopServiceProvider.php
|
MIT
|
public function __construct( \Illuminate\Contracts\Config\Repository $config )
{
$this->config = $config;
}
|
Initializes the object
@param \Illuminate\Contracts\Config\Repository $config Configuration object
|
__construct
|
php
|
aimeos/aimeos-laravel
|
src/Base/Aimeos.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/Aimeos.php
|
MIT
|
public function get() : \Aimeos\Bootstrap
{
if( $this->object === null )
{
$dir = base_path( 'ext' );
if( !is_dir( $dir ) ) {
$dir = dirname( __DIR__, 4 ) . DIRECTORY_SEPARATOR . 'ext';
}
$extDirs = (array) $this->config->get( 'shop.extdir', $dir );
$this->object = new \Aimeos\Bootstrap( $extDirs, false );
}
return $this->object;
}
|
Returns the Aimeos object.
@return \Aimeos\Bootstrap Aimeos bootstrap object
|
get
|
php
|
aimeos/aimeos-laravel
|
src/Base/Aimeos.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/Aimeos.php
|
MIT
|
public function getVersion() : string
{
if( ( $content = @file_get_contents( base_path( 'composer.lock' ) ) ) !== false
&& ( $content = json_decode( $content, true ) ) !== null && isset( $content['packages'] )
) {
foreach( (array) $content['packages'] as $item )
{
if( $item['name'] === 'aimeos/aimeos-laravel' ) {
return $item['version'];
}
}
}
return '';
}
|
Returns the version of the Aimeos package
@return string Version string
|
getVersion
|
php
|
aimeos/aimeos-laravel
|
src/Base/Aimeos.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/Aimeos.php
|
MIT
|
public function __construct( \Illuminate\Contracts\Config\Repository $config, \Aimeos\Shop\Base\Aimeos $aimeos )
{
$this->aimeos = $aimeos;
$this->config = $config;
}
|
Initializes the object
@param \Illuminate\Contracts\Config\Repository $config Configuration object
@param \Aimeos\Shop\Base\Aimeos $aimeos Aimeos object
|
__construct
|
php
|
aimeos/aimeos-laravel
|
src/Base/Config.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/Config.php
|
MIT
|
public function get( string $type = 'frontend' ) : \Aimeos\Base\Config\Iface
{
if( !isset( $this->objects[$type] ) )
{
$configPaths = $this->aimeos->get()->getConfigPaths();
$cfgfile = dirname( dirname( __DIR__ ) ) . '/config/default.php';
$config = new \Aimeos\Base\Config\PHPArray( require $cfgfile, $configPaths );
if( $this->config->get( 'shop.apc_enabled', false ) == true ) {
$config = new \Aimeos\Base\Config\Decorator\APC( $config, $this->config->get( 'shop.apc_prefix', 'laravel:' ) );
}
$config = new \Aimeos\Base\Config\Decorator\Memory( $config, $this->config->get( 'shop' ) );
if( ( $conf = $this->config->get( 'shop.' . $type, [] ) ) !== [] ) {
$config = new \Aimeos\Base\Config\Decorator\Memory( $config, $conf );
}
$this->objects[$type] = $config;
}
return $this->objects[$type];
}
|
Creates a new configuration object.
@param string $type Configuration type ("frontend" or "backend")
@return \Aimeos\Base\Config\Iface Configuration object
|
get
|
php
|
aimeos/aimeos-laravel
|
src/Base/Config.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/Config.php
|
MIT
|
public function __construct( \Illuminate\Session\Store $session, \Aimeos\Shop\Base\Config $config, \Aimeos\Shop\Base\Locale $locale, \Aimeos\Shop\Base\I18n $i18n )
{
$this->session = $session;
$this->config = $config;
$this->locale = $locale;
$this->i18n = $i18n;
}
|
Initializes the object
@param \Illuminate\Session\Store $session Laravel session object
@param \Aimeos\Shop\Base\Config $config Configuration object
@param \Aimeos\Shop\Base\Locale $locale Locale object
@param \Aimeos\Shop\Base\I18n $i18n Internationalisation object
|
__construct
|
php
|
aimeos/aimeos-laravel
|
src/Base/Context.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/Context.php
|
MIT
|
public function get( bool $locale = true, string $type = 'frontend' ) : \Aimeos\MShop\ContextIface
{
$config = $this->config->get( $type );
if( $this->context === null )
{
$context = new \Aimeos\MShop\Context();
$context->setConfig( $config );
$this->addDataBaseManager( $context );
$this->addFilesystemManager( $context );
$this->addMessageQueueManager( $context );
$this->addLogger( $context );
$this->addCache( $context );
$this->addMailer( $context );
$this->addNonce( $context );
$this->addPassword( $context );
$this->addProcess( $context );
$this->addSession( $context );
$this->addToken( $context );
$this->addUserGroups( $context );
$this->context = $context;
}
$this->context->setConfig( $config );
if( $locale === true )
{
$localeItem = $this->locale->get( $this->context );
$this->context->setLocale( $localeItem );
$this->context->setI18n( $this->i18n->get( array( $localeItem->getLanguageId() ) ) );
$config->apply( $localeItem->getSiteItem()->getConfig() );
}
return $this->context;
}
|
Returns the current context
@param bool $locale True to add locale object to context, false if not (deprecated, use \Aimeos\Shop\Base\Locale)
@param string $type Configuration type, i.e. "frontend" or "backend" (deprecated, use \Aimeos\Shop\Base\Config)
@return \Aimeos\MShop\ContextIface Context object
|
get
|
php
|
aimeos/aimeos-laravel
|
src/Base/Context.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/Context.php
|
MIT
|
protected function addCache( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface
{
$cache = \Aimeos\MAdmin::create( $context, 'cache' )->getCache();
return $context->setCache( $cache );
}
|
Adds the cache object to the context
@param \Aimeos\MShop\ContextIface $context Context object including config
@return \Aimeos\MShop\ContextIface Modified context object
|
addCache
|
php
|
aimeos/aimeos-laravel
|
src/Base/Context.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/Context.php
|
MIT
|
protected function addDatabaseManager( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface
{
$dbm = new \Aimeos\Base\DB\Manager\Standard( $context->config()->get( 'resource' ), 'DBAL' );
return $context->setDatabaseManager( $dbm );
}
|
Adds the database manager object to the context
@param \Aimeos\MShop\ContextIface $context Context object
@return \Aimeos\MShop\ContextIface Modified context object
|
addDatabaseManager
|
php
|
aimeos/aimeos-laravel
|
src/Base/Context.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/Context.php
|
MIT
|
protected function addFilesystemManager( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface
{
$config = $context->config()->get( 'resource' );
$fs = new \Aimeos\Base\Filesystem\Manager\Laravel( app( 'filesystem' ), $config, storage_path( 'aimeos' ) );
return $context->setFilesystemManager( $fs );
}
|
Adds the filesystem manager object to the context
@param \Aimeos\MShop\ContextIface $context Context object
@return \Aimeos\MShop\ContextIface Modified context object
|
addFilesystemManager
|
php
|
aimeos/aimeos-laravel
|
src/Base/Context.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/Context.php
|
MIT
|
protected function addLogger( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface
{
$logger = \Aimeos\MAdmin::create( $context, 'log' );
return $context->setLogger( $logger );
}
|
Adds the logger object to the context
@param \Aimeos\MShop\ContextIface $context Context object
@return \Aimeos\MShop\ContextIface Modified context object
|
addLogger
|
php
|
aimeos/aimeos-laravel
|
src/Base/Context.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/Context.php
|
MIT
|
protected function addMailer( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface
{
$mail = new \Aimeos\Base\Mail\Manager\Laravel( app( 'mail.manager' ) );
return $context->setMail( $mail );
}
|
Adds the mailer object to the context
@param \Aimeos\MShop\ContextIface $context Context object
@return \Aimeos\MShop\ContextIface Modified context object
|
addMailer
|
php
|
aimeos/aimeos-laravel
|
src/Base/Context.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/Context.php
|
MIT
|
protected function addMessageQueueManager( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface
{
$mq = new \Aimeos\Base\MQueue\Manager\Standard( $context->config()->get( 'resource' ) );
return $context->setMessageQueueManager( $mq );
}
|
Adds the message queue manager object to the context
@param \Aimeos\MShop\ContextIface $context Context object
@return \Aimeos\MShop\ContextIface Modified context object
|
addMessageQueueManager
|
php
|
aimeos/aimeos-laravel
|
src/Base/Context.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/Context.php
|
MIT
|
protected function addNonce( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface
{
return $context->setNonce( base64_encode( random_bytes( 16 ) ) );
}
|
Adds the nonce value for inline JS to the context
@param \Aimeos\MShop\ContextIface $context Context object
@return \Aimeos\MShop\ContextIface Modified context object
|
addNonce
|
php
|
aimeos/aimeos-laravel
|
src/Base/Context.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/Context.php
|
MIT
|
protected function addPassword( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface
{
return $context->setPassword( new \Aimeos\Base\Password\Standard() );
}
|
Adds the password hasher object to the context
@param \Aimeos\MShop\ContextIface $context Context object
@return \Aimeos\MShop\ContextIface Modified context object
|
addPassword
|
php
|
aimeos/aimeos-laravel
|
src/Base/Context.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/Context.php
|
MIT
|
protected function addProcess( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface
{
$config = $context->config();
$max = $config->get( 'pcntl_max', 4 );
$prio = $config->get( 'pcntl_priority', 19 );
$process = new \Aimeos\Base\Process\Pcntl( $max, $prio );
$process = new \Aimeos\Base\Process\Decorator\Check( $process );
return $context->setProcess( $process );
}
|
Adds the process object to the context
@param \Aimeos\MShop\ContextIface $context Context object
@return \Aimeos\MShop\ContextIface Modified context object
|
addProcess
|
php
|
aimeos/aimeos-laravel
|
src/Base/Context.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/Context.php
|
MIT
|
protected function addSession( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface
{
$session = new \Aimeos\Base\Session\Laravel( $this->session );
return $context->setSession( $session );
}
|
Adds the session object to the context
@param \Aimeos\MShop\ContextIface $context Context object
@return \Aimeos\MShop\ContextIface Modified context object
|
addSession
|
php
|
aimeos/aimeos-laravel
|
src/Base/Context.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/Context.php
|
MIT
|
protected function addToken( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface
{
if( ( $token = Session::get( 'token' ) ) === null ) {
Session::put( 'token', $token = Session::getId() );
}
return $context->setToken( $token );
}
|
Adds the session token to the context
@param \Aimeos\MShop\ContextIface $context Context object
@return \Aimeos\MShop\ContextIface Modified context object
|
addToken
|
php
|
aimeos/aimeos-laravel
|
src/Base/Context.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/Context.php
|
MIT
|
protected function addUserGroups( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\ContextIface
{
$key = collect( config( 'shop.routes' ) )
->where( 'prefix', optional( Route::getCurrentRoute() )->getPrefix() )
->keys()->first();
$gname = data_get( config( 'shop.guards' ), $key, Auth::getDefaultDriver() );
if( ( $guard = Auth::guard( $gname ) ) && ( $userid = $guard->id() ) )
{
$context->setUser( function() use ( $context, $userid ) {
try {
return \Aimeos\MShop::create( $context, 'customer' )->get( $userid, ['group'] );
} catch( \Aimeos\MShop\Exception $e ) { // avoid errors if user is assigned to another site
return null;
}
} );
$context->setGroups( function() use ( $context ) {
return $context->user()?->getGroups() ?? [];
} );
$context->setEditor( $guard->user()?->email ?: \Request::ip() );
}
elseif( $ip = \Request::ip() )
{
$context->setEditor( $ip );
}
return $context;
}
|
Adds the user and groups if available
@param \Aimeos\MShop\ContextIface $context Context object
@return \Aimeos\MShop\ContextIface Modified context object
|
addUserGroups
|
php
|
aimeos/aimeos-laravel
|
src/Base/Context.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/Context.php
|
MIT
|
public function __construct( \Illuminate\Contracts\Config\Repository $config, \Aimeos\Shop\Base\Aimeos $aimeos )
{
$this->aimeos = $aimeos;
$this->config = $config;
}
|
Initializes the object
@param \Illuminate\Contracts\Config\Repository $config Configuration object
@param \Aimeos\Shop\Base\Aimeos $aimeos Aimeos object
|
__construct
|
php
|
aimeos/aimeos-laravel
|
src/Base/I18n.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/I18n.php
|
MIT
|
public function get( array $languageIds ) : array
{
$i18nPaths = $this->aimeos->get()->getI18nPaths();
foreach( $languageIds as $langid )
{
if( !isset( $this->i18n[$langid] ) )
{
$i18n = new \Aimeos\Base\Translation\Gettext( $i18nPaths, $langid );
if( $this->config->get( 'shop.apc_enabled', false ) == true ) {
$i18n = new \Aimeos\Base\Translation\Decorator\APC( $i18n, $this->config->get( 'shop.apc_prefix', 'laravel:' ) );
}
if( $this->config->has( 'shop.i18n.' . $langid ) ) {
$i18n = new \Aimeos\Base\Translation\Decorator\Memory( $i18n, $this->config->get( 'shop.i18n.' . $langid ) );
}
$this->i18n[$langid] = $i18n;
}
}
return $this->i18n;
}
|
Creates new translation objects.
@param array $languageIds List of two letter ISO language IDs
@return \Aimeos\Base\Translation\Iface[] List of translation objects
|
get
|
php
|
aimeos/aimeos-laravel
|
src/Base/I18n.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/I18n.php
|
MIT
|
public function __construct( \Illuminate\Contracts\Config\Repository $config )
{
$this->config = $config;
}
|
Initializes the object
@param \Illuminate\Contracts\Config\Repository $config Configuration object
|
__construct
|
php
|
aimeos/aimeos-laravel
|
src/Base/Locale.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/Locale.php
|
MIT
|
public function get( \Aimeos\MShop\ContextIface $context ) : \Aimeos\MShop\Locale\Item\Iface
{
if( $this->locale === null )
{
$site = config( 'shop.mshop.locale.site', 'default' );
$lang = app()->getLocale();
$currency = '';
if( Route::current() )
{
$site = Request::route( 'site', $site );
$lang = Request::route( 'locale', $lang );
$currency = Request::route( 'currency', $currency );
}
$site = Request::input( 'site', $site );
$lang = Request::input( 'locale', $lang );
$currency = Request::input( 'currency', $currency );
$localeManager = \Aimeos\MShop::create( $context, 'locale' );
$disableSites = $this->config->get( 'shop.disableSites', true );
$this->locale = $localeManager->bootstrap( $site, $lang, $currency, $disableSites );
}
return $this->locale;
}
|
Returns the locale item for the current request
@param \Aimeos\MShop\ContextIface $context Context object
@return \Aimeos\MShop\Locale\Item\Iface Locale item object
|
get
|
php
|
aimeos/aimeos-laravel
|
src/Base/Locale.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/Locale.php
|
MIT
|
public function getBackend( \Aimeos\MShop\ContextIface $context, string $site ) : \Aimeos\MShop\Locale\Item\Iface
{
$localeManager = \Aimeos\MShop::create( $context, 'locale' );
try {
$localeItem = $localeManager->bootstrap( $site, '', '', false, null, true );
} catch( \Aimeos\MShop\Exception $e ) {
$localeItem = $localeManager->create();
}
return $localeItem->setCurrencyId( null )->setLanguageId( null );
}
|
Returns the locale item for the current request
@param \Aimeos\MShop\ContextIface $context Context object
@param string $site Unique site code
@return \Aimeos\MShop\Locale\Item\Iface Locale item object
|
getBackend
|
php
|
aimeos/aimeos-laravel
|
src/Base/Locale.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/Locale.php
|
MIT
|
public function __construct( \Aimeos\Shop\Base\Aimeos $aimeos,
\Aimeos\Shop\Base\Context $context, \Aimeos\Shop\Base\View $view )
{
$this->context = $context->get();
$locale = $this->context->locale();
$tmplPaths = $aimeos->get()->getTemplatePaths( 'client/html/templates', $locale->getSiteItem()->getTheme() );
$langid = $locale->getLanguageId();
$this->view = $view->create( $this->context, $tmplPaths, $langid );
$this->context->setView( $this->view );
}
|
Initializes the object
@param \Aimeos\Shop\Base\Aimeos $aimeos Aimeos object
@param \Aimeos\Shop\Base\Context $context Context object
@param \Aimeos\Shop\Base\View $view View object
|
__construct
|
php
|
aimeos/aimeos-laravel
|
src/Base/Shop.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/Shop.php
|
MIT
|
public function get( string $name ) : \Aimeos\Client\Html\Iface
{
if( !isset( $this->objects[$name] ) )
{
$client = \Aimeos\Client\Html::create( $this->context, $name );
$client->setView( clone $this->view );
$client->init();
$this->objects[$name] = $client;
}
return $this->objects[$name];
}
|
Returns the HTML client for the given name
@param string $name Name of the shop component
@return \Aimeos\Client\Html\Iface HTML client
|
get
|
php
|
aimeos/aimeos-laravel
|
src/Base/Shop.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/Shop.php
|
MIT
|
public function template( string $name ) : string
{
$theme = $this->context->locale()->getSiteItem()->getTheme();
return \Illuminate\Support\Facades\View::exists( $theme . '::' . $name ) ? $theme . '::' . $name : 'shop::' . $name;
}
|
Returns the view template for the given name
@param string $name View name, e.g. "account.index"
@return string Template name, e.g. "shop::account.indx"
|
template
|
php
|
aimeos/aimeos-laravel
|
src/Base/Shop.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/Shop.php
|
MIT
|
public function view() : \Aimeos\Base\View\Iface
{
return $this->view;
}
|
Returns the used view object
@return \Aimeos\Base\View\Iface View object
|
view
|
php
|
aimeos/aimeos-laravel
|
src/Base/Shop.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/Shop.php
|
MIT
|
public function __construct( \Aimeos\Shop\Base\Context $context, \Aimeos\Shop\Base\Locale $locale )
{
$this->context = $context;
$this->locale = $locale;
}
|
Initializes the object
@param \Aimeos\Shop\Base\Context $context Context provider
@param \Aimeos\Shop\Base\Locale $locale Locale provider
|
__construct
|
php
|
aimeos/aimeos-laravel
|
src/Base/Support.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/Support.php
|
MIT
|
public function checkUserGroup( \Illuminate\Foundation\Auth\User $user, $groupcodes ) : bool
{
$groups = ( is_array( $groupcodes ) ? implode( ',', $groupcodes ) : $groupcodes );
if( isset( $this->access[$user->id][$groups] ) ) {
return $this->access[$user->id][$groups];
}
$this->access[$user->id][$groups] = false;
$context = $this->context->get( false );
$siteid = current( array_reverse( explode( '.', trim( $user->siteid, '.' ) ) ) );
if( $siteid ) {
$site = \Aimeos\MShop::create( $context, 'locale/site' )->get( $siteid )->getCode();
} else {
$site = config( 'shop.mshop.locale.site', 'default' );
}
$site = ( Route::current() ? Route::input( 'site', Request::get( 'site', $site ) ) : $site );
$context->setLocale( $this->locale->getBackend( $context, $site ) );
foreach( array_reverse( $context->locale()->getSitePath() ) as $siteid )
{
if( $user->siteid === '' || $user->siteid === $siteid ) {
$this->access[$user->id][$groups] = $this->checkGroups( $context, $user->id, $groupcodes );
}
}
return $this->access[$user->id][$groups];
}
|
Checks if the user is in the specified group and associatied to the site
@param \Illuminate\Foundation\Auth\User $user Authenticated user
@param string|array $groupcodes Unique user/customer group codes that are allowed
@return bool True if user is part of the group, false if not
|
checkUserGroup
|
php
|
aimeos/aimeos-laravel
|
src/Base/Support.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/Support.php
|
MIT
|
protected function checkGroups( \Aimeos\MShop\ContextIface $context, string $userid, $groupcodes ) : bool
{
$manager = \Aimeos\MShop::create( $context, 'group' );
$search = $manager->filter();
$search->setConditions( $search->compare( '==', 'group.code', (array) $groupcodes ) );
$groupIds = $manager->search( $search )->keys()->toArray();
$manager = \Aimeos\MShop::create( $context, 'customer/lists' );
$search = $manager->filter()->slice( 0, 1 );
$expr = array(
$search->compare( '==', 'customer.lists.parentid', $userid ),
$search->compare( '==', 'customer.lists.refid', $groupIds ),
$search->compare( '==', 'customer.lists.domain', 'group' ),
);
$search->setConditions( $search->combine( '&&', $expr ) );
return !$manager->search( $search )->isEmpty();
}
|
Checks if one of the groups is associated to the given user ID
@param \Aimeos\MShop\ContextIface $context Context item
@param string $userid ID of the logged in user
@param string[]|string $groupcodes List of group codes to check against
@return bool True if the user is in one of the groups, false if not
|
checkGroups
|
php
|
aimeos/aimeos-laravel
|
src/Base/Support.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/Support.php
|
MIT
|
public function __construct( \Illuminate\Contracts\Config\Repository $config,
\Aimeos\Shop\Base\I18n $i18n, \Aimeos\Shop\Base\Support $support )
{
$this->i18n = $i18n;
$this->config = $config;
$this->support = $support;
}
|
Initializes the object
@param \Illuminate\Contracts\Config\Repository $config Configuration object
@param \Aimeos\Shop\Base\I18n $i18n I18n object
@param \Aimeos\Shop\Base\Support $support Support object
|
__construct
|
php
|
aimeos/aimeos-laravel
|
src/Base/View.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/View.php
|
MIT
|
public function create( \Aimeos\MShop\ContextIface $context, array $templatePaths,
string $locale = null ) : \Aimeos\Base\View\Iface
{
$engine = new \Aimeos\Base\View\Engine\Blade( app( 'Illuminate\Contracts\View\Factory' ) );
$view = new \Aimeos\Base\View\Standard( $templatePaths, array( '.blade.php' => $engine ) );
$config = $context->config();
$session = $context->session();
$this->addCsrf( $view );
$this->addAccess( $view, $context );
$this->addConfig( $view, $config );
$this->addNumber( $view, $config, $locale );
$this->addParam( $view );
$this->addRequest( $view );
$this->addResponse( $view );
$this->addSession( $view, $session );
$this->addTranslate( $view, $locale );
$this->addUrl( $view );
return $view;
}
|
Creates the view object for the HTML client.
@param \Aimeos\MShop\ContextIface $context Context object
@param array $templatePaths List of base path names with relative template paths as key/value pairs
@param string|null $locale Code of the current language or null for no translation
@return \Aimeos\Base\View\Iface View object
|
create
|
php
|
aimeos/aimeos-laravel
|
src/Base/View.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/View.php
|
MIT
|
protected function addAccess( \Aimeos\Base\View\Iface $view, \Aimeos\MShop\ContextIface $context ) : \Aimeos\Base\View\Iface
{
if( $this->config->get( 'shop.accessControl', true ) === false
|| ( ( $user = \Illuminate\Support\Facades\Auth::user() ) !== null && $user->superuser )
) {
$helper = new \Aimeos\Base\View\Helper\Access\All( $view );
}
else
{
$helper = new \Aimeos\Base\View\Helper\Access\Standard( $view, function() use ( $context ) {
$manager = \Aimeos\MShop::create( $context, 'group' );
$filter = $manager->filter( true )->add( 'group.id', '==', $context->groups() );
return $manager->search( $filter )->col( 'group.code' )->all();
} );
}
$view->addHelper( 'access', $helper );
return $view;
}
|
Adds the "access" helper to the view object
@param \Aimeos\Base\View\Iface $view View object
@param \Aimeos\MShop\ContextIface $context Context object
@return \Aimeos\Base\View\Iface Modified view object
|
addAccess
|
php
|
aimeos/aimeos-laravel
|
src/Base/View.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/View.php
|
MIT
|
protected function addConfig( \Aimeos\Base\View\Iface $view, \Aimeos\Base\Config\Iface $config ) : \Aimeos\Base\View\Iface
{
$config = new \Aimeos\Base\Config\Decorator\Protect( clone $config, ['resource/*/baseurl'], ['resource'] );
$helper = new \Aimeos\Base\View\Helper\Config\Standard( $view, $config );
$view->addHelper( 'config', $helper );
return $view;
}
|
Adds the "config" helper to the view object
@param \Aimeos\Base\View\Iface $view View object
@param \Aimeos\Base\Config\Iface $config Configuration object
@return \Aimeos\Base\View\Iface Modified view object
|
addConfig
|
php
|
aimeos/aimeos-laravel
|
src/Base/View.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/View.php
|
MIT
|
protected function addCsrf( \Aimeos\Base\View\Iface $view ) : \Aimeos\Base\View\Iface
{
$helper = new \Aimeos\Base\View\Helper\Csrf\Standard( $view, '_token', csrf_token() );
$view->addHelper( 'csrf', $helper );
return $view;
}
|
Adds the "access" helper to the view object
@param \Aimeos\Base\View\Iface $view View object
@return \Aimeos\Base\View\Iface Modified view object
|
addCsrf
|
php
|
aimeos/aimeos-laravel
|
src/Base/View.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/View.php
|
MIT
|
protected function addNumber( \Aimeos\Base\View\Iface $view, \Aimeos\Base\Config\Iface $config,
string $locale = null ) : \Aimeos\Base\View\Iface
{
if( config( 'shop.num_formatter', 'Locale' ) === 'Locale' )
{
$pattern = $config->get( 'client/html/common/format/pattern' );
$helper = new \Aimeos\Base\View\Helper\Number\Locale( $view, $locale, $pattern );
}
else
{
$sep1000 = $config->get( 'client/html/common/format/separator1000', '' );
$decsep = $config->get( 'client/html/common/format/separatorDecimal', '.' );
$helper = new \Aimeos\Base\View\Helper\Number\Standard( $view, $decsep, $sep1000 );
}
return $view->addHelper( 'number', $helper );
}
|
Adds the "number" helper to the view object
@param \Aimeos\Base\View\Iface $view View object
@param \Aimeos\Base\Config\Iface $config Configuration object
@param string|null $locale Code of the current language or null for no translation
@return \Aimeos\Base\View\Iface Modified view object
|
addNumber
|
php
|
aimeos/aimeos-laravel
|
src/Base/View.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/View.php
|
MIT
|
protected function addParam( \Aimeos\Base\View\Iface $view ) : \Aimeos\Base\View\Iface
{
$params = ( Route::current() ? Route::current()->parameters() : array() ) + Request::all();
$helper = new \Aimeos\Base\View\Helper\Param\Standard( $view, $params );
$view->addHelper( 'param', $helper );
return $view;
}
|
Adds the "param" helper to the view object
@param \Aimeos\Base\View\Iface $view View object
@return \Aimeos\Base\View\Iface Modified view object
|
addParam
|
php
|
aimeos/aimeos-laravel
|
src/Base/View.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/View.php
|
MIT
|
protected function addRequest( \Aimeos\Base\View\Iface $view ) : \Aimeos\Base\View\Iface
{
$helper = new \Aimeos\Base\View\Helper\Request\Laravel( $view, Request::instance() );
$view->addHelper( 'request', $helper );
return $view;
}
|
Adds the "request" helper to the view object
@param \Aimeos\Base\View\Iface $view View object
@return \Aimeos\Base\View\Iface Modified view object
|
addRequest
|
php
|
aimeos/aimeos-laravel
|
src/Base/View.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/View.php
|
MIT
|
protected function addResponse( \Aimeos\Base\View\Iface $view ) : \Aimeos\Base\View\Iface
{
$helper = new \Aimeos\Base\View\Helper\Response\Laravel( $view );
$view->addHelper( 'response', $helper );
return $view;
}
|
Adds the "response" helper to the view object
@param \Aimeos\Base\View\Iface $view View object
@return \Aimeos\Base\View\Iface Modified view object
|
addResponse
|
php
|
aimeos/aimeos-laravel
|
src/Base/View.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/View.php
|
MIT
|
protected function addSession( \Aimeos\Base\View\Iface $view, \Aimeos\Base\Session\Iface $session ) : \Aimeos\Base\View\Iface
{
$helper = new \Aimeos\Base\View\Helper\Session\Standard( $view, $session );
$view->addHelper( 'session', $helper );
return $view;
}
|
Adds the "session" helper to the view object
@param \Aimeos\Base\View\Iface $view View object
@param \Aimeos\Base\Session\Iface $session Session object
@return \Aimeos\Base\View\Iface Modified view object
|
addSession
|
php
|
aimeos/aimeos-laravel
|
src/Base/View.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/View.php
|
MIT
|
protected function addTranslate( \Aimeos\Base\View\Iface $view, ?string $locale = null ) : \Aimeos\Base\View\Iface
{
if( $locale !== null )
{
$i18n = $this->i18n->get( array( $locale ) );
$translation = $i18n[$locale];
}
else
{
$translation = new \Aimeos\Base\Translation\None( 'en' );
}
$helper = new \Aimeos\Base\View\Helper\Translate\Standard( $view, $translation );
$view->addHelper( 'translate', $helper );
return $view;
}
|
Adds the "translate" helper to the view object
@param \Aimeos\Base\View\Iface $view View object
@param string|null $locale ISO language code, e.g. "de" or "de_CH"
@return \Aimeos\Base\View\Iface Modified view object
|
addTranslate
|
php
|
aimeos/aimeos-laravel
|
src/Base/View.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/View.php
|
MIT
|
protected function addUrl( \Aimeos\Base\View\Iface $view ) : \Aimeos\Base\View\Iface
{
$fixed = [
'site' => env( 'SHOP_MULTISHOP' ) ? config( 'shop.mshop.locale.site', 'default' ) : '',
'locale' => env( 'SHOP_MULTILOCALE' ) ? app()->getLocale() : '',
'currency' => ''
];
if( Route::current() )
{
$fixed['site'] = Request::route( 'site', $fixed['site'] );
$fixed['locale'] = Request::route( 'locale', $fixed['locale'] );
$fixed['currency'] = Request::route( 'currency', $fixed['currency'] );
}
$fixed['site'] = Request::input( 'site', $fixed['site'] );
$fixed['locale'] = Request::input( 'locale', $fixed['locale'] );
$fixed['currency'] = Request::input( 'currency', $fixed['currency'] );
$helper = new \Aimeos\Base\View\Helper\Url\Laravel( $view, app( 'url' ), array_filter( $fixed ) );
$view->addHelper( 'url', $helper );
return $view;
}
|
Adds the "url" helper to the view object
@param \Aimeos\Base\View\Iface $view View object
@return \Aimeos\Base\View\Iface Modified view object
|
addUrl
|
php
|
aimeos/aimeos-laravel
|
src/Base/View.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Base/View.php
|
MIT
|
protected function addConfig( \Aimeos\MShop\ContextIface $ctx ) : \Aimeos\MShop\ContextIface
{
$config = $ctx->config();
foreach( (array) $this->option( 'option' ) as $option )
{
list( $name, $value ) = explode( ':', $option );
$config->set( $name, $value );
}
return $ctx;
}
|
Adds the configuration options from the input object to the given context
@param \Aimeos\MShop\ContextIface $ctx Context object
|
addConfig
|
php
|
aimeos/aimeos-laravel
|
src/Command/AbstractCommand.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Command/AbstractCommand.php
|
MIT
|
protected function exec( \Aimeos\MShop\ContextIface $context, \Closure $fcn, $sites )
{
$process = $context->process();
$aimeos = $this->getLaravel()->make( 'aimeos' )->get();
$siteManager = \Aimeos\MShop::create( $context, 'locale/site' );
$localeManager = \Aimeos\MShop::create( $context, 'locale' );
$filter = $siteManager->filter();
$start = 0;
if( !empty( $sites ) ) {
$filter->add( ['locale.site.code' => !is_array( $sites ) ? explode( ' ', (string) $sites ) : $sites] );
}
do
{
$siteItems = $siteManager->search( $filter->slice( $start ) );
foreach( $siteItems as $siteItem )
{
\Aimeos\MShop::cache( true );
\Aimeos\MAdmin::cache( true );
$localeItem = $localeManager->bootstrap( $siteItem->getCode(), '', '', false );
$localeItem->setLanguageId( null );
$localeItem->setCurrencyId( null );
$lcontext = clone $context;
$lcontext->setLocale( $localeItem );
$tmplPaths = $aimeos->getTemplatePaths( 'controller/jobs/templates', $siteItem->getTheme() );
$view = $this->getLaravel()->make( 'aimeos.view' )->create( $lcontext, $tmplPaths );
$lcontext->setView( $view );
$config = $lcontext->config();
$config->apply( $siteItem->getConfig() );
$process->start( $fcn, [$lcontext, $aimeos], false );
}
$count = count( $siteItems );
$start += $count;
}
while( $count === $filter->getLimit() );
$process->wait();
}
|
Executes the function for all given sites
@param \Aimeos\MShop\ContextIface $context Context object
@param \Closure $fcn Function to execute
@param array|string|null $sites Site codes
|
exec
|
php
|
aimeos/aimeos-laravel
|
src/Command/AbstractCommand.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Command/AbstractCommand.php
|
MIT
|
public function handle()
{
$site = $this->argument( 'site' ) ?: config( 'shop.mshop.locale.site', 'default' );
if( ( $email = $this->argument( 'email' ) ) === null ) {
$email = $this->ask( 'E-Mail' );
}
if( ( $password = $this->option( 'password' ) ) === null ) {
$password = $this->secret( 'Password' );
}
$context = $this->getLaravel()->make( 'aimeos.context' )->get( false, 'command' );
$context->setEditor( 'aimeos:account' );
$localeManager = \Aimeos\MShop::create( $context, 'locale' );
$localeItem = $localeManager->bootstrap( $site, '', '', false, null, true );
$context->setLocale( $localeItem );
$manager = \Aimeos\MShop::create( $context, 'customer' );
try {
$item = $manager->find( $email );
} catch( \Aimeos\MShop\Exception $e ) {
$item = $manager->create();
}
$item = $item->setCode( $email )->setLabel( $email )->setPassword( $password )->setStatus( 1 );
$item->getPaymentAddress()->setEmail( $email );
$item = $manager->save( $this->addGroups( $context, $item ) );
\Illuminate\Foundation\Auth\User::findOrFail( $item->getId() )
->forceFill( [
'siteid' => $this->option( 'super' ) ? '' : $item->getSiteId(),
'superuser' => ( $this->option( 'super' ) ? 1 : 0 ),
'email_verified_at' => now(),
] )->save();
}
|
Execute the console command.
@return mixed
|
handle
|
php
|
aimeos/aimeos-laravel
|
src/Command/AccountCommand.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Command/AccountCommand.php
|
MIT
|
protected function addGroups( \Aimeos\MShop\ContextIface $context,
\Aimeos\MShop\Customer\Item\Iface $user ) : \Aimeos\MShop\Customer\Item\Iface
{
if( $this->option( 'admin' ) ) {
$user = $this->addGroup( $context, $user, 'admin' );
}
if( $this->option( 'editor' ) ) {
$user = $this->addGroup( $context, $user, 'editor' );
}
return $user;
}
|
Adds the group to the given user
@param \Aimeos\MShop\ContextIface $context Aimeos context object
@param \Aimeos\MShop\Customer\Item\Iface $user Aimeos customer object
@return \Aimeos\MShop\Customer\Item\Iface Updated customer object
|
addGroups
|
php
|
aimeos/aimeos-laravel
|
src/Command/AccountCommand.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Command/AccountCommand.php
|
MIT
|
protected function addGroup( \Aimeos\MShop\ContextIface $context, \Aimeos\MShop\Customer\Item\Iface $user,
string $group ) : \Aimeos\MShop\Customer\Item\Iface
{
$msg = 'Add "%1$s" group to user "%2$s" for site "%3$s"';
$site = $this->argument( 'site' ) ?: config( 'shop.mshop.locale.site', 'default' );
$this->info( sprintf( $msg, $group, $user->getCode(), $site ) );
$item = $this->getGroupItem( $context, $group );
return $user->setGroups( array_merge( $user->getGroups(), [$item->getId()] ) );
}
|
Adds the group to the given user
@param \Aimeos\MShop\ContextIface $context Aimeos context object
@param \Aimeos\MShop\Customer\Item\Iface $user Aimeos customer object
@param string $group Unique customer group code
|
addGroup
|
php
|
aimeos/aimeos-laravel
|
src/Command/AccountCommand.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Command/AccountCommand.php
|
MIT
|
protected function getGroupItem( \Aimeos\MShop\ContextIface $context, string $code ) : \Aimeos\MShop\Group\Item\Iface
{
$manager = \Aimeos\MShop::create( $context, 'group' );
try
{
$item = $manager->find( $code );
}
catch( \Aimeos\MShop\Exception $e )
{
$item = $manager->create();
$item->setLabel( $code );
$item->setCode( $code );
$manager->save( $item );
}
return $item;
}
|
Returns the customer group item for the given code
@param \Aimeos\MShop\ContextIface $context Aimeos context object
@param string $code Unique customer group code
@return \Aimeos\MShop\Group\Item\Iface Aimeos customer group item object
|
getGroupItem
|
php
|
aimeos/aimeos-laravel
|
src/Command/AccountCommand.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Command/AccountCommand.php
|
MIT
|
public function handle()
{
$this->info( 'Clearing Aimeos cache', 'v' );
$context = $this->getLaravel()->make( 'aimeos.context' )->get( false, 'command' );
$context->setEditor( 'aimeos:clear' );
\Aimeos\MAdmin::create( $context, 'cache' )->getCache()->clear();
}
|
Execute the console command.
@return mixed
|
handle
|
php
|
aimeos/aimeos-laravel
|
src/Command/ClearCommand.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Command/ClearCommand.php
|
MIT
|
public function handle()
{
$jobs = $this->argument( 'jobs' );
$jobs = !is_array( $jobs ) ? explode( ' ', (string) $jobs ) : $jobs;
$fcn = function( \Aimeos\MShop\ContextIface $lcontext, \Aimeos\Bootstrap $aimeos ) use ( $jobs )
{
$jobfcn = function( $context, $aimeos, $jobname ) {
\Aimeos\Controller\Jobs::create( $context, $aimeos, $jobname )->run();
};
$process = $lcontext->process();
$site = $lcontext->locale()->getSiteItem()->getCode();
foreach( $jobs as $jobname )
{
$this->info( sprintf( 'Executing Aimeos jobs "%s" for "%s"', $jobname, $site ), 'v' );
$process->start( $jobfcn, [$lcontext, $aimeos, $jobname], false );
}
$process->wait();
};
$this->exec( $this->context(), $fcn, $this->argument( 'site' ) );
}
|
Execute the console command.
@return mixed
|
handle
|
php
|
aimeos/aimeos-laravel
|
src/Command/JobsCommand.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Command/JobsCommand.php
|
MIT
|
protected function context() : \Aimeos\MShop\ContextIface
{
$lv = $this->getLaravel();
$aimeos = $lv->make( 'aimeos' )->get();
$context = $lv->make( 'aimeos.context' )->get( false, 'command' );
$tmplPaths = $aimeos->getTemplatePaths( 'controller/jobs/templates' );
$view = $lv->make( 'aimeos.view' )->create( $context, $tmplPaths );
$langManager = \Aimeos\MShop::create( $context, 'locale/language' );
$langids = $langManager->search( $langManager->filter( true ) )->keys()->toArray();
$i18n = $lv->make( 'aimeos.i18n' )->get( $langids );
$context->setSession( new \Aimeos\Base\Session\None() );
$context->setCache( new \Aimeos\Base\Cache\None() );
$context->setEditor( 'aimeos:jobs' );
$context->setView( $view );
$context->setI18n( $i18n );
return $this->addConfig( $context );
}
|
Returns a context object
@return \Aimeos\MShop\ContextIface Context object
|
context
|
php
|
aimeos/aimeos-laravel
|
src/Command/JobsCommand.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Command/JobsCommand.php
|
MIT
|
public function handle()
{
\Aimeos\MShop::cache( false );
\Aimeos\MAdmin::cache( false );
$template = $this->argument( 'tplsite' );
if( ( $site = $this->argument( 'site' ) ) === null ) {
$site = config( 'shop.mshop.locale.site', 'default' );
}
$boostrap = $this->getLaravel()->make( 'aimeos' )->get();
$ctx = $this->getLaravel()->make( 'aimeos.context' )->get( false, 'command' );
$this->info( sprintf( 'Initializing or updating the Aimeos database tables for site "%1$s"', $site ) );
\Aimeos\Setup::use( $boostrap )
->verbose( $this->option( 'q' ) ? '' : $this->option( 'v' ) )
->context( $this->addConfig( $ctx->setEditor( 'aimeos:setup' ) ) )
->up( $site, $template );
}
|
Execute the console command.
@return mixed
|
handle
|
php
|
aimeos/aimeos-laravel
|
src/Command/SetupCommand.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Command/SetupCommand.php
|
MIT
|
public function indexAction()
{
$params = ['page' => 'page-account-index'];
foreach( app( 'config' )->get( 'shop.page.account-index' ) as $name )
{
$params['aiheader'][$name] = Shop::get( $name )->header();
$params['aibody'][$name] = Shop::get( $name )->body();
}
return Response::view( Shop::template( 'account.index' ), $params )
->header( 'Cache-Control', 'no-store, max-age=0' );
}
|
Returns the html for the "My account" page.
@return \Illuminate\Http\Response Response object with output and headers
|
indexAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/AccountController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/AccountController.php
|
MIT
|
public function downloadAction()
{
$response = Shop::get( 'account/download' )->response();
return Response::make( (string) $response->getBody(), $response->getStatusCode(), $response->getHeaders() );
}
|
Returns the html for the "My account" download page.
@return \Illuminate\Contracts\View\View View for rendering the output
|
downloadAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/AccountController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/AccountController.php
|
MIT
|
public function indexAction( \Illuminate\Http\Request $request )
{
if( Auth::check() === false
|| $request->user()->can( 'admin', [AdminController::class, config( 'shop.roles', ['admin', 'editor'] )] ) === false
) {
return redirect()->guest( airoute( 'login', ['locale' => app()->getLocale()] ) );
}
$context = app( 'aimeos.context' )->get( false );
$siteManager = \Aimeos\MShop::create( $context, 'locale/site' );
$siteId = current( array_reverse( explode( '.', trim( $request->user()->siteid, '.' ) ) ) );
$siteCode = ( $siteId ? $siteManager->get( $siteId )->getCode() : config( 'shop.mshop.locale.site', 'default' ) );
$locale = $request->user()->langid ?: config( 'app.locale', 'en' );
$param = array(
'resource' => config( 'shop.panel', 'dashboard' ),
'site' => Route::input( 'site', Request::get( 'site', $siteCode ) ),
'locale' => Route::input( 'locale', Request::get( 'locale', $locale ) )
);
return redirect()->route( 'aimeos_shop_jqadm_search', $param );
}
|
Returns the initial HTML view for the admin interface.
@param \Illuminate\Http\Request $request Laravel request object
@return \Illuminate\Contracts\View\View View for rendering the output
|
indexAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/AdminController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/AdminController.php
|
MIT
|
public function indexAction()
{
$params = ['page' => 'page-basket-index'];
foreach( app( 'config' )->get( 'shop.page.basket-index' ) as $name )
{
$params['aiheader'][$name] = Shop::get( $name )->header();
$params['aibody'][$name] = Shop::get( $name )->body();
}
return Response::view( Shop::template( 'basket.index' ), $params )
->header( 'Cache-Control', 'no-store, , max-age=0' );
}
|
Returns the html for the standard basket page.
@return \Illuminate\Http\Response Response object with output and headers
|
indexAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/BasketController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/BasketController.php
|
MIT
|
public function countAction()
{
$params = ['page' => 'page-catalog-count'];
foreach( app( 'config' )->get( 'shop.page.catalog-count' ) as $name )
{
$params['aiheader'][$name] = Shop::get( $name )->header();
$params['aibody'][$name] = Shop::get( $name )->body();
}
return Response::view( Shop::template( 'catalog.count' ), $params )
->header( 'Content-Type', 'application/javascript' )
->header( 'Cache-Control', 'public, max-age=300' );
}
|
Returns the view for the XHR response with the counts for the facetted search.
@return \Illuminate\Http\Response Response object with output and headers
|
countAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/CatalogController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/CatalogController.php
|
MIT
|
public function detailAction()
{
try
{
$params = ['page' => 'page-catalog-detail'];
foreach( app( 'config' )->get( 'shop.page.catalog-detail' ) as $name )
{
$params['aiheader'][$name] = Shop::get( $name )->header();
$params['aibody'][$name] = Shop::get( $name )->body();
}
return Response::view( Shop::template( 'catalog.detail' ), $params )
->header( 'Cache-Control', 'private, max-age=' . config( 'shop.cache_maxage', 30 ) );
}
catch( \Exception $e )
{
if( $e->getCode() >= 400 && $e->getCode() < 600 ) { abort( $e->getCode() ); }
throw $e;
}
}
|
Returns the html for the catalog detail page.
@return \Illuminate\Http\Response Response object with output and headers
|
detailAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/CatalogController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/CatalogController.php
|
MIT
|
public function homeAction()
{
$params = ['page' => 'page-catalog-home'];
foreach( app( 'config' )->get( 'shop.page.catalog-home' ) as $name )
{
$params['aiheader'][$name] = Shop::get( $name )->header();
$params['aibody'][$name] = Shop::get( $name )->body();
}
return Response::view( Shop::template( 'catalog.home' ), $params )
->header( 'Cache-Control', 'private, max-age=' . config( 'shop.cache_maxage', 30 ) );
}
|
Returns the html for the catalog home page.
@return \Illuminate\Http\Response Response object with output and headers
|
homeAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/CatalogController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/CatalogController.php
|
MIT
|
public function listAction()
{
$params = ['page' => 'page-catalog-list'];
foreach( app( 'config' )->get( 'shop.page.catalog-list' ) as $name )
{
$params['aiheader'][$name] = Shop::get( $name )->header();
$params['aibody'][$name] = Shop::get( $name )->body();
}
return Response::view( Shop::template( 'catalog.list' ), $params )
->header( 'Cache-Control', 'private, max-age=' . config( 'shop.cache_maxage', 30 ) );
}
|
Returns the html for the catalog list page.
@return \Illuminate\Http\Response Response object with output and headers
|
listAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/CatalogController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/CatalogController.php
|
MIT
|
public function sessionAction()
{
$params = ['page' => 'page-catalog-session'];
foreach( app( 'config' )->get( 'shop.page.catalog-session' ) as $name )
{
$params['aiheader'][$name] = Shop::get( $name )->header();
$params['aibody'][$name] = Shop::get( $name )->body();
}
return Response::view( Shop::template( 'catalog.session' ), $params )
->header( 'Cache-Control', 'no-cache' );
}
|
Returns the html for the catalog session page.
@return \Illuminate\Http\Response Response object with output and headers
|
sessionAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/CatalogController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/CatalogController.php
|
MIT
|
public function stockAction()
{
$params = ['page' => 'page-catalog-stock'];
foreach( app( 'config' )->get( 'shop.page.catalog-stock' ) as $name )
{
$params['aiheader'][$name] = Shop::get( $name )->header();
$params['aibody'][$name] = Shop::get( $name )->body();
}
return Response::view( Shop::template( 'catalog.stock' ), $params )
->header( 'Content-Type', 'application/javascript' )
->header( 'Cache-Control', 'public, max-age=30' );
}
|
Returns the html body part for the catalog stock page.
@return \Illuminate\Http\Response Response object with output and headers
|
stockAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/CatalogController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/CatalogController.php
|
MIT
|
public function suggestAction()
{
$params = ['page' => 'page-catalog-suggest'];
foreach( app( 'config' )->get( 'shop.page.catalog-suggest' ) as $name )
{
$params['aiheader'][$name] = Shop::get( $name )->header();
$params['aibody'][$name] = Shop::get( $name )->body();
}
return Response::view( Shop::template( 'catalog.suggest' ), $params )
->header( 'Cache-Control', 'private, max-age=' . config( 'shop.cache_maxage', 30 ) )
->header( 'Content-Type', 'application/json' );
}
|
Returns the view for the XHR response with the product information for the search suggestion.
@return \Illuminate\Http\Response Response object with output and headers
|
suggestAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/CatalogController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/CatalogController.php
|
MIT
|
public function treeAction()
{
try
{
$params = ['page' => 'page-catalog-tree'];
foreach( app( 'config' )->get( 'shop.page.catalog-tree' ) as $name )
{
$params['aiheader'][$name] = Shop::get( $name )->header();
$params['aibody'][$name] = Shop::get( $name )->body();
}
return Response::view( Shop::template( 'catalog.tree' ), $params )
->header( 'Cache-Control', 'private, max-age=' . config( 'shop.cache_maxage', 30 ) );
}
catch( \Exception $e )
{
if( $e->getCode() >= 400 && $e->getCode() < 600 ) { abort( $e->getCode() ); }
throw $e;
}
}
|
Returns the html for the catalog tree page.
@return \Illuminate\Http\Response Response object with output and headers
|
treeAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/CatalogController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/CatalogController.php
|
MIT
|
public function confirmAction()
{
$params = ['page' => 'page-checkout-confirm'];
foreach( app( 'config' )->get( 'shop.page.checkout-confirm' ) as $name )
{
$params['aiheader'][$name] = Shop::get( $name )->header();
$params['aibody'][$name] = Shop::get( $name )->body();
}
return Response::view( Shop::template( 'checkout.confirm' ), $params )
->header( 'Cache-Control', 'no-store, max-age=0' );
}
|
Returns the html for the checkout confirmation page.
@return \Illuminate\Http\Response Response object with output and headers
|
confirmAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/CheckoutController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/CheckoutController.php
|
MIT
|
public function indexAction()
{
$params = ['page' => 'page-checkout-index'];
foreach( app( 'config' )->get( 'shop.page.checkout-index' ) as $name )
{
$params['aiheader'][$name] = Shop::get( $name )->header();
$params['aibody'][$name] = Shop::get( $name )->body();
}
return Response::view( Shop::template( 'checkout.index' ), $params )
->header( 'Cache-Control', 'no-store, max-age=0' );
}
|
Returns the html for the standard checkout page.
@return \Illuminate\Http\Response Response object with output and headers
|
indexAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/CheckoutController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/CheckoutController.php
|
MIT
|
public function updateAction()
{
$params = ['page' => 'page-checkout-update'];
foreach( app( 'config' )->get( 'shop.page.checkout-update' ) as $name )
{
$params['aiheader'][$name] = Shop::get( $name )->header();
$params['aibody'][$name] = Shop::get( $name )->body();
}
return Response::view( Shop::template( 'checkout.update' ), $params )
->header( 'Cache-Control', 'no-store, max-age=0' );
}
|
Returns the view for the order update page.
@return \Illuminate\Http\Response Response object with output and headers
|
updateAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/CheckoutController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/CheckoutController.php
|
MIT
|
public function indexAction( ServerRequestInterface $request )
{
if( config( 'shop.authorize', true ) ) {
$this->authorize( 'admin', [GraphqlController::class, array_merge( config( 'shop.roles', ['admin', 'editor'] ), ['api'] )] );
}
$site = Route::input( 'site', Request::get( 'site', config( 'shop.mshop.locale.site', 'default' ) ) );
$lang = Request::get( 'locale', config( 'app.locale', 'en' ) );
$context = app( 'aimeos.context' )->get( false, 'backend' );
$context->setI18n( app( 'aimeos.i18n' )->get( array( $lang, 'en' ) ) );
$context->setLocale( app( 'aimeos.locale' )->getBackend( $context, $site ) );
$context->setView( app( 'aimeos.view' )->create( $context, [], $lang ) );
return \Aimeos\Admin\Graphql::execute( $context, $request );
}
|
Creates a new resource object or a list of resource objects
@param \Psr\Http\Message\ServerRequestInterface $request Request object
@return \Psr\Http\Message\ResponseInterface Response object containing the generated output
|
indexAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/GraphqlController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/GraphqlController.php
|
MIT
|
public function fileAction()
{
if( config( 'shop.authorize', true ) ) {
$this->authorize( 'admin', [JqadmController::class, config( 'shop.roles', ['admin', 'editor'] )] );
}
$files = [];
$aimeos = app( 'aimeos' )->get();
$name = Route::input( 'name', Request::get( 'name' ) );
foreach( $aimeos->getCustomPaths( 'admin/jqadm' ) as $base => $paths )
{
foreach( $paths as $path ) {
$files[] = $base . '/' . $path;
}
}
$response = response( \Aimeos\Admin\JQAdm\Bundle::get( $files, $name ) );
if( str_ends_with( $name, 'js' ) ) {
$response->header( 'Content-Type', 'application/javascript' );
} elseif( str_ends_with( $name, 'css' ) ) {
$response->header( 'Content-Type', 'text/css' );
}
return $response->header( 'Cache-Control', 'public, max-age=3600' );
}
|
Returns the JS file content
@return \Illuminate\Http\Response Response object containing the generated output
|
fileAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/JqadmController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/JqadmController.php
|
MIT
|
public function batchAction()
{
if( config( 'shop.authorize', true ) ) {
$this->authorize( 'admin', [JqadmController::class, config( 'shop.roles', ['admin', 'editor'] )] );
}
$cntl = $this->createAdmin();
if( ( $html = $cntl->batch() ) == '' ) {
return $cntl->response();
}
return $this->getHtml( (string) $html );
}
|
Returns the HTML code for batch operations on a resource object
@return string Generated output
|
batchAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/JqadmController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/JqadmController.php
|
MIT
|
public function copyAction()
{
if( config( 'shop.authorize', true ) ) {
$this->authorize( 'admin', [JqadmController::class, config( 'shop.roles', ['admin', 'editor'] )] );
}
$cntl = $this->createAdmin();
if( ( $html = $cntl->copy() ) == '' ) {
return $cntl->response();
}
return $this->getHtml( (string) $html );
}
|
Returns the HTML code for a copy of a resource object
@return string Generated output
|
copyAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/JqadmController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/JqadmController.php
|
MIT
|
public function createAction()
{
if( config( 'shop.authorize', true ) ) {
$this->authorize( 'admin', [JqadmController::class, config( 'shop.roles', ['admin', 'editor'] )] );
}
$cntl = $this->createAdmin();
if( ( $html = $cntl->create() ) == '' ) {
return $cntl->response();
}
return $this->getHtml( (string) $html );
}
|
Returns the HTML code for a new resource object
@return string Generated output
|
createAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/JqadmController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/JqadmController.php
|
MIT
|
public function deleteAction()
{
if( config( 'shop.authorize', true ) ) {
$this->authorize( 'admin', [JqadmController::class, config( 'shop.roles', ['admin', 'editor'] )] );
}
$cntl = $this->createAdmin();
if( ( $html = $cntl->delete() ) == '' ) {
return $cntl->response();
}
return $this->getHtml( (string) $html );
}
|
Deletes the resource object or a list of resource objects
@return string Generated output
|
deleteAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/JqadmController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/JqadmController.php
|
MIT
|
public function exportAction()
{
if( config( 'shop.authorize', true ) ) {
$this->authorize( 'admin', [JqadmController::class, config( 'shop.roles', ['admin', 'editor'] )] );
}
$cntl = $this->createAdmin();
if( ( $html = $cntl->export() ) == '' ) {
return $cntl->response();
}
return $this->getHtml( (string) $html );
}
|
Exports the data for a resource object
@return string Generated output
|
exportAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/JqadmController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/JqadmController.php
|
MIT
|
public function getAction()
{
if( config( 'shop.authorize', true ) ) {
$this->authorize( 'admin', [JqadmController::class, config( 'shop.roles', ['admin', 'editor'] )] );
}
$cntl = $this->createAdmin();
if( ( $html = $cntl->get() ) == '' ) {
return $cntl->response();
}
return $this->getHtml( (string) $html );
}
|
Returns the HTML code for the requested resource object
@return string Generated output
|
getAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/JqadmController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/JqadmController.php
|
MIT
|
public function importAction()
{
if( config( 'shop.authorize', true ) ) {
$this->authorize( 'admin', [JqadmController::class, config( 'shop.roles', ['admin', 'editor'] )] );
}
$cntl = $this->createAdmin();
if( ( $html = $cntl->import() ) == '' ) {
return $cntl->response();
}
return $this->getHtml( (string) $html );
}
|
Imports the data for a resource object
@return string Generated output
|
importAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/JqadmController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/JqadmController.php
|
MIT
|
public function saveAction()
{
if( config( 'shop.authorize', true ) ) {
$this->authorize( 'admin', [JqadmController::class, config( 'shop.roles', ['admin', 'editor'] )] );
}
$cntl = $this->createAdmin();
if( ( $html = $cntl->save() ) == '' ) {
return $cntl->response();
}
return $this->getHtml( (string) $html );
}
|
Saves a new resource object
@return string Generated output
|
saveAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/JqadmController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/JqadmController.php
|
MIT
|
public function searchAction()
{
if( config( 'shop.authorize', true ) ) {
$this->authorize( 'admin', [JqadmController::class, config( 'shop.roles', ['admin', 'editor'] )] );
}
$cntl = $this->createAdmin();
if( ( $html = $cntl->search() ) == '' ) {
return $cntl->response();
}
return $this->getHtml( (string) $html );
}
|
Returns the HTML code for a list of resource objects
@return string Generated output
|
searchAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/JqadmController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/JqadmController.php
|
MIT
|
protected function createAdmin() : \Aimeos\Admin\JQAdm\Iface
{
$site = Route::input( 'site', Request::get( 'site', config( 'shop.mshop.locale.site', 'default' ) ) );
$lang = Request::get( 'locale', config( 'app.locale', 'en' ) );
$resource = Route::input( 'resource' );
$aimeos = app( 'aimeos' )->get();
$context = app( 'aimeos.context' )->get( false, 'backend' );
$context->setI18n( app( 'aimeos.i18n' )->get( array( $lang, 'en' ) ) );
$context->setLocale( app( 'aimeos.locale' )->getBackend( $context, $site )->setLanguageId( $lang ) );
$siteManager = \Aimeos\MShop::create( $context, 'locale/site' );
$context->config()->apply( $siteManager->find( $site )->getConfig() );
$paths = $aimeos->getTemplatePaths( 'admin/jqadm/templates', $context->locale()->getSiteItem()->getTheme() );
$view = app( 'aimeos.view' )->create( $context, $paths, $lang );
$view->aimeosType = 'Laravel';
$view->aimeosVersion = app( 'aimeos' )->getVersion();
$view->aimeosExtensions = implode( ',', $aimeos->getExtensions() );
$context->setView( $view );
return \Aimeos\Admin\JQAdm::create( $context, $aimeos, $resource );
}
|
Returns the resource controller
@return \Aimeos\Admin\JQAdm\Iface JQAdm client
|
createAdmin
|
php
|
aimeos/aimeos-laravel
|
src/Controller/JqadmController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/JqadmController.php
|
MIT
|
protected function getHtml( string $content )
{
$site = Route::input( 'site', Request::get( 'site', config( 'shop.mshop.locale.site', 'default' ) ) );
$lang = Request::get( 'locale', config( 'app.locale', 'en' ) );
return View::make( 'shop::jqadm.index', [
'content' => $content,
'site' => $site,
'locale' => $lang,
'localeDir' => in_array( $lang, ['ar', 'az', 'dv', 'fa', 'he', 'ku', 'ur'] ) ? 'rtl' : 'ltr',
'theme' => ( $_COOKIE['aimeos_backend_theme'] ?? '' ) == 'dark' ? 'dark' : 'light'
] );
}
|
Returns the generated HTML code
@param string $content Content from admin client
@return \Illuminate\Contracts\View\View View for rendering the output
|
getHtml
|
php
|
aimeos/aimeos-laravel
|
src/Controller/JqadmController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/JqadmController.php
|
MIT
|
public function deleteAction( ServerRequestInterface $request )
{
if( config( 'shop.authorize', true ) ) {
$this->authorize( 'admin', [JsonadmController::class, array_merge( config( 'shop.roles', ['admin', 'editor'] ), ['api'] )] );
}
return $this->createAdmin()->delete( $request, ( new Psr17Factory )->createResponse() );
}
|
Deletes the resource object or a list of resource objects
@param \Psr\Http\Message\ServerRequestInterface $request Request object
@return \Psr\Http\Message\ResponseInterface Response object containing the generated output
|
deleteAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/JsonadmController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/JsonadmController.php
|
MIT
|
public function getAction( ServerRequestInterface $request )
{
if( config( 'shop.authorize', true ) ) {
$this->authorize( 'admin', [JsonadmController::class, array_merge( config( 'shop.roles', ['admin', 'editor'] ), ['api'] )] );
}
return $this->createAdmin()->get( $request, ( new Psr17Factory )->createResponse() );
}
|
Returns the requested resource object or list of resource objects
@param \Psr\Http\Message\ServerRequestInterface $request Request object
@return \Psr\Http\Message\ResponseInterface Response object containing the generated output
|
getAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/JsonadmController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/JsonadmController.php
|
MIT
|
public function patchAction( ServerRequestInterface $request )
{
if( config( 'shop.authorize', true ) ) {
$this->authorize( 'admin', [JsonadmController::class, array_merge( config( 'shop.roles', ['admin', 'editor'] ), ['api'] )] );
}
return $this->createAdmin()->patch( $request, ( new Psr17Factory )->createResponse() );
}
|
Updates a resource object or a list of resource objects
@param \Psr\Http\Message\ServerRequestInterface $request Request object
@return \Psr\Http\Message\ResponseInterface Response object containing the generated output
|
patchAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/JsonadmController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/JsonadmController.php
|
MIT
|
public function postAction( ServerRequestInterface $request )
{
if( config( 'shop.authorize', true ) ) {
$this->authorize( 'admin', [JsonadmController::class, array_merge( config( 'shop.roles', ['admin', 'editor'] ), ['api'] )] );
}
return $this->createAdmin()->post( $request, ( new Psr17Factory )->createResponse() );
}
|
Creates a new resource object or a list of resource objects
@param \Psr\Http\Message\ServerRequestInterface $request Request object
@return \Psr\Http\Message\ResponseInterface Response object containing the generated output
|
postAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/JsonadmController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/JsonadmController.php
|
MIT
|
public function putAction( ServerRequestInterface $request )
{
if( config( 'shop.authorize', true ) ) {
$this->authorize( 'admin', [JsonadmController::class, array_merge( config( 'shop.roles', ['admin', 'editor'] ), ['api'] )] );
}
return $this->createAdmin()->put( $request, ( new Psr17Factory )->createResponse() );
}
|
Creates or updates a single resource object
@param \Psr\Http\Message\ServerRequestInterface $request Request object
@return \Psr\Http\Message\ResponseInterface Response object containing the generated output
|
putAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/JsonadmController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/JsonadmController.php
|
MIT
|
public function optionsAction( ServerRequestInterface $request )
{
if( config( 'shop.authorize', true ) ) {
$this->authorize( 'admin', [JsonadmController::class, array_merge( config( 'shop.roles', ['admin', 'editor'] ), ['api'] )] );
}
return $this->createAdmin()->options( $request, ( new Psr17Factory )->createResponse() );
}
|
Returns the available HTTP verbs and the resource URLs
@param \Psr\Http\Message\ServerRequestInterface $request Request object
@return \Psr\Http\Message\ResponseInterface Response object containing the generated output
|
optionsAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/JsonadmController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/JsonadmController.php
|
MIT
|
protected function createAdmin() : \Aimeos\Admin\JsonAdm\Iface
{
$site = Route::input( 'site', Request::get( 'site', config( 'shop.mshop.locale.site', 'default' ) ) );
$lang = Request::get( 'locale', config( 'app.locale', 'en' ) );
$resource = Route::input( 'resource', '' );
$aimeos = app( 'aimeos' )->get();
$templatePaths = $aimeos->getTemplatePaths( 'admin/jsonadm/templates' );
$context = app( 'aimeos.context' )->get( false, 'backend' );
$context->setI18n( app( 'aimeos.i18n' )->get( array( $lang, 'en' ) ) );
$context->setLocale( app( 'aimeos.locale' )->getBackend( $context, $site ) );
$context->setView( app( 'aimeos.view' )->create( $context, $templatePaths, $lang ) );
return \Aimeos\Admin\JsonAdm::create( $context, $aimeos, $resource );
}
|
Returns the JsonAdm client
@return \Aimeos\Admin\JsonAdm\Iface JsonAdm client
|
createAdmin
|
php
|
aimeos/aimeos-laravel
|
src/Controller/JsonadmController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/JsonadmController.php
|
MIT
|
public function deleteAction( ServerRequestInterface $request )
{
return $this->createClient()->delete( $request, ( new Psr17Factory )->createResponse() );
}
|
Deletes the resource object or a list of resource objects
@param \Psr\Http\Message\ServerRequestInterface $request Request object
@return \Psr\Http\Message\ResponseInterface Response object containing the generated output
|
deleteAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/JsonapiController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/JsonapiController.php
|
MIT
|
public function getAction( ServerRequestInterface $request )
{
return $this->createClient()->get( $request, ( new Psr17Factory )->createResponse() );
}
|
Returns the requested resource object or list of resource objects
@param \Psr\Http\Message\ServerRequestInterface $request Request object
@return \Psr\Http\Message\ResponseInterface Response object containing the generated output
|
getAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/JsonapiController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/JsonapiController.php
|
MIT
|
public function patchAction( ServerRequestInterface $request )
{
return $this->createClient()->patch( $request, ( new Psr17Factory )->createResponse() );
}
|
Updates a resource object or a list of resource objects
@param \Psr\Http\Message\ServerRequestInterface $request Request object
@return \Psr\Http\Message\ResponseInterface Response object containing the generated output
|
patchAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/JsonapiController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/JsonapiController.php
|
MIT
|
public function postAction( ServerRequestInterface $request )
{
return $this->createClient()->post( $request, ( new Psr17Factory )->createResponse() );
}
|
Creates a new resource object or a list of resource objects
@param \Psr\Http\Message\ServerRequestInterface $request Request object
@return \Psr\Http\Message\ResponseInterface Response object containing the generated output
|
postAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/JsonapiController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/JsonapiController.php
|
MIT
|
public function putAction( ServerRequestInterface $request )
{
return $this->createClient()->put( $request, ( new Psr17Factory )->createResponse() );
}
|
Creates or updates a single resource object
@param \Psr\Http\Message\ServerRequestInterface $request Request object
@return \Psr\Http\Message\ResponseInterface Response object containing the generated output
|
putAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/JsonapiController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/JsonapiController.php
|
MIT
|
public function optionsAction( ServerRequestInterface $request )
{
return $this->createClient()->options( $request, ( new Psr17Factory )->createResponse() )
->withHeader( 'access-control-allow-headers', 'authorization,content-type' )
->withHeader( 'access-control-allow-methods', 'DELETE, GET, OPTIONS, PATCH, POST, PUT' )
->withHeader( 'access-control-allow-origin', $request->getHeaderLine( 'origin' ) );
}
|
Returns the available HTTP verbs and the resource URLs
@param \Psr\Http\Message\ServerRequestInterface $request Request object
@return \Psr\Http\Message\ResponseInterface Response object containing the generated output
|
optionsAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/JsonapiController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/JsonapiController.php
|
MIT
|
protected function createClient() : \Aimeos\Client\JsonApi\Iface
{
$resource = Route::input( 'resource' );
$related = Route::input( 'related', Request::get( 'related' ) );
$aimeos = app( 'aimeos' )->get();
$context = app( 'aimeos.context' )->get();
$tmplPaths = $aimeos->getTemplatePaths( 'client/jsonapi/templates', $context->locale()->getSiteItem()->getTheme() );
$langid = $context->locale()->getLanguageId();
$context->setView( app( 'aimeos.view' )->create( $context, $tmplPaths, $langid ) );
return \Aimeos\Client\JsonApi::create( $context, $resource . '/' . $related );
}
|
Returns the JsonAdm client
@return \Aimeos\Client\JsonApi\Iface JsonApi client
|
createClient
|
php
|
aimeos/aimeos-laravel
|
src/Controller/JsonapiController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/JsonapiController.php
|
MIT
|
public function indexAction()
{
$params = ['page' => 'page-index'];
foreach( app( 'config' )->get( 'shop.page.cms', ['cms/page', 'catalog/tree', 'basket/mini'] ) as $name )
{
$params['aiheader'][$name] = Shop::get( $name )->header();
$params['aibody'][$name] = Shop::get( $name )->body();
}
if( empty( $params['aibody']['cms/page'] ) ) {
abort( 404 );
}
return Response::view( Shop::template( 'page.index' ), $params )
->header( 'Cache-Control', 'private, max-age=10' );
}
|
Returns the html for the content pages.
@return \Psr\Http\Message\ResponseInterface Response object containing the generated output
|
indexAction
|
php
|
aimeos/aimeos-laravel
|
src/Controller/PageController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/PageController.php
|
MIT
|
public static function register( string $name, \Closure $fcn )
{
self::$fcn[$name] = $fcn;
}
|
Register a new resolver function.
@param string $name Name of the resolver function
@param \Closure $fcn Resolver function
|
register
|
php
|
aimeos/aimeos-laravel
|
src/Controller/ResolveController.php
|
https://github.com/aimeos/aimeos-laravel/blob/master/src/Controller/ResolveController.php
|
MIT
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.