Category Archives: PHP

NestedTree Notes

Wiki:

https://en.wikipedia.org/wiki/Nested_set_model

Update nest_left and nest_right values of all nodes:

Notes:

  • In October CMS, a category must have nest_left and nest_right values or it will cause serious error.

Request Validation

Doc:

https://laravel.com/docs/5.4/validation#creating-form-requests

Command:

Example:

 

 

Laravel Translate Model (dimsav/laravel-translatable)

Official Doc

https://github.com/dimsav/laravel-translatable#tutorials

Schema

Main table: store_menu, translated table: store_menu_translations

Full example:

How to Add Multi-Language Models to Laravel QuickAdminPanel

Controller to save data

TranslateM

 

Ajax Response Trait

 

Laravel Form Validator

Command

Available Rules

https://laravel.com/docs/5.4/validation#available-validation-rules

Example

 

Laravel Seeder Example

https://laravel.com/docs/5.8/seeding

Seed Language Table

DatabaseSeeder

 

Command

 

Multi-language Controller

Javascript

 

Laravel Route

Example

Included

Front end usage