PHP code example of wamesk / laravel-commands

1. Go to this page and download the library: Download wamesk/laravel-commands library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

wamesk / laravel-commands example snippets


// config/wame-commands.php

return [
    /* Version of ApiController you want to develop (v1, v2, v3, null) */
//    'version' => 'v1', // Default: null

    /* Typ of id your project is using (options: id (basic integer), uuid, ulid) */
//    'id-type' => 'uuid', // Default: ulid

    /* Enable or disable sorting in migration and model */
//    'sorting' => false, // Default: true

    /* Per page pagination default */
//    'per_page' => 10, // Default: 10

    /* What language mutations should it generate. All will contain EN phrases. */
//    'langs' => ['en'], // Default: en

    /* You can disable commands that wame:make will run. By default, all will run. */
    'make' => [
//        'api-controllers' => false,
//        'events' => false,
//        'lang' => false,
//        'listeners' => false,
//        'migration' => false,
//        'model' => false,
//        'nova' => false,
//        'observer' => false,
//        'policy' => false,
    ],
];

// wame-commands.php

// Will add HasUuids or Ulids to model depending on id-type
'id-type' => 'ulid', // Other options: id, uuid

// Will add SortableTrait and Sortable interface to class along with $sortable array config
'sorting' => true, // Other option: false

// wame-commands.php

// Will add SortableTrait and Sortable interface to class along with $sortable array config
'sorting' => true, // Other option: false

// wame-commands.php

// Will add id column depending on id-type
'id-type' => 'ulid', // Other options: id, uuid

// Will add `$table->unsignedInteger('sort')->nullable();` column
'sorting' => true, // Other option: false

/* What language mutations should it generate. All will contain EN phrases. */
'langs' => ['en'], // Default: en

 

return [
    'label' => 'Users',
    'plural' => 'Users',
    'singular' => 'User',
    'detail' => 'User: :title',

    'create.button' => 'Create user',
    'update.button' => 'Update user',

];

use Wame\LaravelCommands\Utils\Helpers;

$camelCase = Helpers::camelCaseConvert('SuperModel');

return $camelCase; // returns 'super_model'

$data = ['email' => '[email protected]', 'password' => 'password'];

$validator = Validator::validate($data, [
    'email' => 'email|

$data = ['email' => '[email protected]', 'password' => 'password'];

$validator = Validator::code('1.2')->validate($data, [
    'email' => 'email|

Validator::statusCode($statusCode)->code($code)->validate($data, $rules);
shell
php artisan vendor:publish --provider="Wame\LaravelCommands\LaravelCommandsServiceProvider"

project
 └─ config
     └─ wame-commands.php
shell
php artisan wame:make <name>
shell
php artisan wame:model
shell
php artisan wame:nova
shell
php artisan wame:migration
shell
php artisan wame:model
shell
php artisan wame:events
shell
php artisan wame:listeners
shell
php artisan wame:api-controller
shell
php artisan wame:lang
shell
php artisan wame:policy