PHP code example of llama-laravel / modules

1. Go to this page and download the library: Download llama-laravel/modules 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/ */

    

llama-laravel / modules example snippets


'providers' => [
  Llama\Modules\ModuleServiceProvider::class,
],

'aliases' => [
  'Module' => Llama\Modules\Facades\Module::class,
],

Module::factory(App\User::class, 50)->create()->each(function ($u) {
    $u->posts()->save(factory(App\Post::class)->make());
});

Module::all();

Module::getCached()

Module::getOrdered();

Module::scan();

Module::find('name');
#OR
Module::get('name');

Module::findOrFail('module-name');

Module::getScannedLocations();

Module::toCollection();

Module::getByStatus(1);

Module::has('blog');

Module::activated();

Module::deactivated();

Module::count();

Module::getPath();

Module::register();

Module::boot();

Module::collections();

Module::getModulePath('name');

Module::assetPath('name');

Module::config('composer.vendor');

Module::getUsedStoragePath();

Module::used();

Module::used('name');

Module::getAssetsPath();

Module::getNamespace();

Module::asset('blog::img/logo.img');

Module::install('llama-laravel-modules/hello');

Module::update('hello');

$module = Module::find('blog');

$module->getName();

$module->getLowerName();

$module->getStudlyName();

$module->getPath();

$module->getExtraPath('assets');

$module->disable();

$module->enable();

$module->delete();

$module->getNamespace();

Lang::get('blog::group.name');
#OR
trans('blog::group.name');

View::make('blog::index');
#OR
View::make('blog::partials.sidebar');

Config::get('blog.name');
#OR
config('blog.name');

// file config/modules.php

return [
  //...
  'scan' => [
    'enabled' => true
  ]
  //...
];

php artisan vendor:publish --provider="Llama\Modules\ModuleServiceProvider"

php artisan module:make <module-name>

your-laravel/app/Modules/
  ├── Blog/
      ├── Config/
      ├── Database/
          ├── Seeds/
      ├── Http/
          ├── Controllers/
      ├── Providers/
      ├── Resources/
          ├── assets/
          ├── lang/
          ├── views/
      ├── Routes/
          ├── web.php
          ├── api.php
      ├── composer.json
      ├── module.json

php artisan module:make blog

php artisan module:make-migration create_users_table blog
#OR
php artisan module:make-migration create_users_table blog --create=users
#OR
php artisan module:make-migration add_email_to_users_table blog --table=users

php artisan module:migrate-rollback
#OR
php artisan module:migrate-reset
#OR
php artisan module:migrate-refresh

php artisan module:migrate-rollback blog
#OR
php artisan module:migrate-reset blog
#OR
php artisan module:migrate-refresh blog

php artisan module:migrate blog

php artisan module:migrate

php artisan module:make-seeder PostsTableSeeder blog

php artisan module:db-seed blog

php artisan module:db-seed

php artisan module:make-controller SiteController blog

php artisan module:link blog

php artisan module:link

php artisan module:make-model User blog

php artisan module:make-provider MyServiceProvider blog

php artisan module:make-policy PostsPolicy blog

php artisan module:make-route blog

php artisan module:make-request CreateRequest blog

php artisan module:make-event CreateEvent blog

php artisan module:make-job CreateJob blog

php artisan module:make-middleware CreateNewPostMiddleware blog

php artisan module:make-mail WelcomeEmail checkout
#OR
php artisan module:make-mail WelcomeEmail checkout --markdown=emails.checkout.shipped

php artisan module:make-notification InvoicePaid checkout
#OR
php artisan module:make-notification InvoicePaid checkout --markdown=notifications.checkout.shipped

php artisan module:enable blog

php artisan module:disable blog