2017 © Pedro Peláez
 

library aalberts-pxlcms

Laravel adapter for the Aalberts PXL CMS

image

czim/aalberts-pxlcms

Laravel adapter for the Aalberts PXL CMS

  • Friday, March 31, 2017
  • by czim
  • Repository
  • 1 Watchers
  • 1 Stars
  • 265 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 14 Versions
  • 0 % Grown

The README.md

Aalberts Laravel PXL CMS Adapter

Nothing to see here for now. See the PXLCMS adapter package for more information., (*1)

Install

Via Composer, (*2)

``` bash $ composer require czim/aalberts-pxlcms, (*3)


Add this line of code to the providers array located in your `config/app.php` file: ``` php Aalberts\AalbertsCmsServiceProvider::class,

And add the facade aliases to the same file:, (*4)

``` php 'Aalberts' => Aalberts\Facades\AalbertsFacade::class, 'Translate' => Aalberts\Facades\TranslateFacade::class,, (*5)


Publish the configuration: ``` bash $ php artisan vendor:publish

Set up event listening for missing translation phrases. Add the following pair to your EventServiceProvider class:, (*6)

``` php \Aalberts\Events\DetectedMissingTranslationPhrase::class => [ \Aalberts\Listeners\MissingTranslationPhraseListener::class ], \Aalberts\Events\SearchPerformed::class => [ \Aalberts\Listeners\SearchListener::class ],, (*7)


## Cache This package requires that a cache driver be used that supports tagging (such as Redis). ## Configuration ### .env Set the following keys for your application in the `.env` file like so (or adjust `confing/aalberts.php` directly). ``` bash AALBERTS_ORGANIZATION=2 AALBERTS_ORGANIZATION_KEY=VSH

Scheduling

Translations, CMS content and Compano content are all cached for common lookups. All translations should be loaded in cache at all times; other content may be cached on demand., (*8)

A typical schedule for this in your Console/Kernel.php is:, (*9)

        $schedule->command('aalberts:cache:translations')->everyFiveMinutes();
        $schedule->command('aalberts:cache:cms:check')->everyTenMinutes();
        $schedule->command('aalberts:cache:cmp:check')->dailyAt('06:00');

Translations

Labels

It is much more efficient to keep all translations cached, to prevent lookups for individual atrans() calls. Translations are not automatically cached, at least not in a batch., (*10)

To make sure the cache stays up to date, schedule the artisan:cache:translations command to run periodically. It is recommended to keep the interval at least 5 minutes or to prevent overlap. The command will check whether a cache is required by comparing the latest modifiedts date for all the organization's translations. If no updates since the last cache time are detected, the cache will not be renewed., (*11)

If no cache has been set at all, this command will always fill the cache., (*12)

Local translations

Add aalberts translations files for all locales that your application uses and set content like the following:, (*13)

``` php <?php, (*14)

return [, (*15)

'months' => [
    '01' => 'jan',
    '02' => 'feb',
    '03' => 'mrt',
    '04' => 'apr',
    '05' => 'mei',
    '06' => 'jun',
    '07' => 'jul',
    '08' => 'aug',
    '09' => 'sep',
    '10' => 'okt',
    '11' => 'nov',
    '12' => 'dec',
],

];, (*16)


This will be used by the `StandardDateFormatter`. ## Usage Run the generator to make the models and repositories: ``` bash $ php artisan aalberts:generate

This command works exactly like the czim/laravel-pxlcms package pxlcms:generate command., (*17)

Presenters

Some models have presenters from the Laracasts presenter package., (*18)

ToDo: add support for this to the package - How to override and/or set your own presenter classes. - Provide default presenters - Set up date formatting (with 'special' standard class), (*19)

Translation

Note that the Translator expects the generated Phrase and Translation classes to be in App\Models\Aalberts. Anywhere else will break the built-in Translator class., (*20)

Filters

Adding a Filter

Things to update:, (*21)

  • Add the filter slugs & validation rules to the Aalberts\Filters\ProductFilterData (don't forget the $defaults key!)
  • Add the filter slugs to the Aalberts\Filters\ProductFilter properties
  • Add an Aalberts\Filters\ParameterCounters\.. Counter class
  • Add an Aalberts\Filters\ParameterFilters\.. Parameter class
  • If it doesn't exist yet, add a repository for the Compano filter target model (such as for cmp_applications)
  • Update the Aalberts\Factories\FilterStrategyFactory: set the repository for the slug

Credits

License

The MIT License (MIT). Please see License File for more information., (*22)

The Versions