Installazione Last updated: 2019-10-24 08:39:27

come installare

Requisiti

  • Composer
  • Laravel Framework 5.8+
  • Laravel Mix
  • Node.js & NPM

Installare via base_* repository

per vedere la lista delle base_ su github andare https://github.com/laraxot?utf8=%E2%9C%93&q=base_&type=&language=


git clone [url della repo] [path di dove si vuole installare] --recurse-submodule --depth 1
cd [path di dove si vuole installare]
cd laravel
cp .env.latest .env
[aprire e modificare file .env]
composer update
php artisan migrate 

continuare con i moduli

Creare un SuperAdmin

Se per la creazione utenti usate il modulo LU 

$ php artisan lu:user

 What is your nickname [without space and special characters]?:
 > marco

 Email Address:
 > marco@gmail.com

 What is the password?:
 >

 User's level [1=>registered,2=>Editor,3=Moderator,4=Admin,5=SuperAdmin]:
 > 5

Success ! User Created !

per Associare la gestione al superUser, questo comando aggiunge tutti i moduli alla gestione backend, e associa tutti a tutti i superuser, poi il superuser decide quale "modulo" puo' gestire un utente

$ php artisan lu:create-areas 

 

creare un proprio progetto da zero

git clone https://github.com/laraxot/base_virgin.git [nome progetto] --recurse-submodule --depth 1
cd [nome progetto]
cd laravel
cp .env.latest .env
[aprire e modificare file .env]
composer update
[creati la tua repository]
 git remote set-url origin [url della tua repository]
 git remote add upstream https://github.com/laraxot/base_virgin.git
[buon divertimento]

Creare una giunzione - MKLINK

Duplicare la cartella laravel/app/config/localhost, rinominandola in "nome_cartella_destinataria-local" 

andare nella directory dove si vuole creare la cartella-giunzione (nell'esempio nome_cartella_destiantaria)

mklink /J "nome_cartella_destinataria" "path_del_progetto"

riavviare il server.

per eseguire il progetto in locale basterà utilizzare l'url

http://nome_cartella_destinataria.local/

 

 

per eliminare una giuzione

rmdir <path to junction link>

Modifiche file originali

Alcuni file necessitano di modifiche:

laravel\routes\web.php: commentare la route di default

/*
Route::get('/', function () {
    return view('welcome');
});
*/

laravel\config\modules.php: inserire questo contenuto (ps: con i vari aggiornamenti di laravel potrebbe cambiare

<?php

use Modules\Xot\Services\TenantService as Tenant;
use Nwidart\Modules\Activators\FileActivator;

return [
    /*
    |--------------------------------------------------------------------------
    | Module Namespace
    |--------------------------------------------------------------------------
    |
    | Default module namespace.
    |
    */

    'namespace' => 'Modules',

    /*
    |--------------------------------------------------------------------------
    | Module Stubs
    |--------------------------------------------------------------------------
    |
    | Default module stubs.
    |
    */

    'stubs' => [
        'enabled' => false,
        'path' => base_path().'/vendor/nwidart/laravel-modules/src/Commands/stubs',
        'files' => [
            'routes/web' => 'Routes/web.php',
            'routes/api' => 'Routes/api.php',
            'views/index' => 'Resources/views/index.blade.php',
            'views/master' => 'Resources/views/layouts/master.blade.php',
            'scaffold/config' => 'Config/config.php',
            'composer' => 'composer.json',
            'assets/js/app' => 'Resources/assets/js/app.js',
            'assets/sass/app' => 'Resources/assets/sass/app.scss',
            'webpack' => 'webpack.mix.js',
            'package' => 'package.json',
        ],
        'replacements' => [
            'routes/web' => ['LOWER_NAME', 'STUDLY_NAME'],
            'routes/api' => ['LOWER_NAME'],
            'webpack' => ['LOWER_NAME'],
            'json' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE', 'PROVIDER_NAMESPACE'],
            'views/index' => ['LOWER_NAME'],
            'views/master' => ['LOWER_NAME', 'STUDLY_NAME'],
            'scaffold/config' => ['STUDLY_NAME'],
            'composer' => [
                'LOWER_NAME',
                'STUDLY_NAME',
                'VENDOR',
                'AUTHOR_NAME',
                'AUTHOR_EMAIL',
                'MODULE_NAMESPACE',
                'PROVIDER_NAMESPACE',
            ],
        ],
        'gitkeep' => true,
    ],
    'paths' => [
        /*
        |--------------------------------------------------------------------------
        | Modules path
        |--------------------------------------------------------------------------
        |
        | This path used for save the generated module. This path also will be added
        | automatically to list of scanned folders.
        |
        */

        'modules' => base_path('Modules'),
        /*
        |--------------------------------------------------------------------------
        | Modules assets path
        |--------------------------------------------------------------------------
        |
        | Here you may update the modules assets path.
        |
        */

        'assets' => public_path('modules'),
        /*
        |--------------------------------------------------------------------------
        | The migrations path
        |--------------------------------------------------------------------------
        |
        | Where you run 'module:publish-migration' command, where do you publish the
        | the migration files?
        |
        */

        'migration' => base_path('database/migrations'),
        /*
        |--------------------------------------------------------------------------
        | Generator path
        |--------------------------------------------------------------------------
        | Customise the paths where the folders will be generated.
        | Set the generate key to false to not generate that folder
        */
        'generator' => [
            'config' => ['path' => 'Config', 'generate' => true],
            'command' => ['path' => 'Console', 'generate' => true],
            'migration' => ['path' => 'Database/Migrations', 'generate' => true],
            'seeder' => ['path' => 'Database/Seeders', 'generate' => true],
            'factory' => ['path' => 'Database/factories', 'generate' => true],
            'model' => ['path' => 'Models', 'generate' => true],
            'routes' => ['path' => 'Routes', 'generate' => true],
            'controller' => ['path' => 'Http/Controllers', 'generate' => true],
            'filter' => ['path' => 'Http/Middleware', 'generate' => true],
            'request' => ['path' => 'Http/Requests', 'generate' => true],
            'provider' => ['path' => 'Providers', 'generate' => true],
            'assets' => ['path' => 'Resources/assets', 'generate' => true],
            'lang' => ['path' => 'Resources/lang', 'generate' => true],
            'views' => ['path' => 'Resources/views', 'generate' => true],
            'test' => ['path' => 'Tests/Unit', 'generate' => true],
            'test-feature' => ['path' => 'Tests/Feature', 'generate' => true],
            'repository' => ['path' => 'Repositories', 'generate' => true],
            'event' => ['path' => 'Events', 'generate' => true],
            'listener' => ['path' => 'Listeners', 'generate' => true],
            'policies' => ['path' => 'Models/Policies', 'generate' => true],
            'rules' => ['path' => 'Rules', 'generate' => true],
            'jobs' => ['path' => 'Jobs', 'generate' => true],
            'emails' => ['path' => 'Mail', 'generate' => true],
            'notifications' => ['path' => 'Notifications', 'generate' => true],
            'resource' => ['path' => 'Transformers', 'generate' => true],
        ],
    ],
    /*
    |--------------------------------------------------------------------------
    | Scan Path
    |--------------------------------------------------------------------------
    |
    | Here you define which folder will be scanned. By default will scan vendor
    | directory. This is useful if you host the package in packagist website.
    |
    */

    'scan' => [
        'enabled' => false,
        'paths' => [
            base_path('vendor/*/*'),
        ],
    ],
    /*
    |--------------------------------------------------------------------------
    | Composer File Template
    |--------------------------------------------------------------------------
    |
    | Here is the config for composer.json file, generated by this package
    |
    */

    'composer' => [
        'vendor' => 'nwidart',
        'author' => [
            'name' => 'Nicolas Widart',
            'email' => 'n.widart@gmail.com',
        ],
    ],
    /*
    |--------------------------------------------------------------------------
    | Caching
    |--------------------------------------------------------------------------
    |
    | Here is the config for setting up caching feature.
    |
    */
    'cache' => [
        'enabled' => false,
        'key' => 'laravel-modules',
        'lifetime' => 60,
    ],
    /*
    |--------------------------------------------------------------------------
    | Choose what laravel-modules will register as custom namespaces.
    | Setting one to false will require you to register that part
    | in your own Service Provider class.
    |--------------------------------------------------------------------------
    */
    'register' => [
        'translations' => true,
        /*
         * load files on boot or register method
         *
         * Note: boot not compatible with asgardcms
         *
         * @example boot|register
         */
        'files' => 'register',
    ],

    /*
    |--------------------------------------------------------------------------
    | Activators
    |--------------------------------------------------------------------------
    |
    | You can define new types of activators here, file, database etc. The only
    | required parameter is 'class'.
    | The file activator will store the activation status in storage/installed_modules
    */
    'activators' => [
        'file' => [
            'class' => FileActivator::class,
            'statuses-file' => Tenant::filePath('modules_statuses.json'),
            'cache-key' => 'activator.installed',
            'cache-lifetime' => 604800,
        ],
    ],

    'activator' => 'file',
];

assicurarsi dell'esistenza del file laravel\config\nome_progetto-local\modules_statuses.json

e assicurarsi che tutti i moduli siano attivi tramite il comando

php artisan module:list

e, nel caso non lo siano, abilitare tutti i moduli (partendo da Xot, il più importante) tramite il comando

php artisan module: enable nome_modulo

File configurazione iniziali

Nella cartella config\nome_progetto-local (utilizzata nella giunzione) ci saranno i seguenti file:

xra.php

 

<?php

 return [
     'adm_theme' => 'nome_tema_admin',
     'enable_ads' => '2',
     'forcessl' => '',
     'model' => [
         'home' => 'Modules\Blog\Models\Home',
         'widget' => 'Modules\Xot\Models\Widget',
     ],
     'primary_lang' => 'it',
     'pub_theme' => 'nome_tema_public',

     'show_trans_key' => 'true',
 ];

services.php

 

<?php

return [
    'facebook' => [
        'client_id' => 'codice',
        'client_secret' => 'codice_alfanumerico',
        'redirect' => 'https://www.food.local/login/facebook/callback',
    ],
    'twitter' => [
        'client_id' => 'codice_id',
        'client_secret' => 'codice_alfanumerico',
        'redirect' => 'https://www.food.local/login/twitter/callback',
    ],
    'google' => [
        'url_location_api' => 'https://maps.googleapis.com/maps/api/geocode/json',
        'maps_key' => 'codice_alfanumerico',
    ],
    'bing' => [
        'url_location_api' => 'http://dev.virtualearth.net/REST/v1/Locations',
        'maps_key' => 'codice_alfanumerico',
    ],
];

metagag.php (con campi da compilare)

 

<?php

return [
    'title' => 'Offerta In',
    'sitename' => '',
    'subtitle' => '',
    'sottotitolo_comune' => '',
    'generator' => '',
    'charset' => 'UTF-8',
    'author' => 'Xot Team',
    'description' => '',
    'keywords' => '',
    'nome_regione' => '',
    'nome_comune' => '',
    'site_title' => '',
    'logo_img' => '',
    'logo_footer_img' => '',
    'logo_alt' => 'Logo',
    'hide_megamenu' => false,
    'hero_type' => 'with_megamenu_bottom',
    'facebook_href' => 'aa',
    'twitter_href' => '',
    'youtube_href' => '',
    'fastlink' => false,
    'color_primary' => '#0071b0',
    'color_title' => 'white',
    'color_megamenu' => '#d60021',
    'color_hamburger' => '#000',
    'color_banner' => '#000',
];

filesystems.php

<?php

return [
    /*
    |--------------------------------------------------------------------------
    | Default Filesystem Disk
    |--------------------------------------------------------------------------
    |
    | Here you may specify the default filesystem disk that should be used
    | by the framework. The "local" disk, as well as a variety of cloud
    | based disks are available to your application. Just store away!
    |
    */

    'default' => env('FILESYSTEM_DRIVER', 'local'),

    /*
    |--------------------------------------------------------------------------
    | Default Cloud Filesystem Disk
    |--------------------------------------------------------------------------
    |
    | Many applications store files both locally and in the cloud. For this
    | reason, you may specify a default "cloud" driver here. This driver
    | will be bound as the Cloud disk implementation in the container.
    |
    */

    'cloud' => env('FILESYSTEM_CLOUD', 's3'),

    /*
    |--------------------------------------------------------------------------
    | Filesystem Disks
    |--------------------------------------------------------------------------
    |
    | Here you may configure as many filesystem "disks" as you wish, and you
    | may even configure multiple disks of the same driver. Defaults have
    | been setup for each driver as an example of the required options.
    |
    | Supported Drivers: "local", "ftp", "sftp", "s3", "rackspace"
    |
    */

    'disks' => [
        'local' => [
            'driver' => 'local',
            'root' => storage_path('app'),
        ],

        'public' => [
            'driver' => 'local',
            'root' => storage_path('app/public'),
            'url' => env('APP_URL').'/storage',
            'visibility' => 'public',
        ],
        'public_html' => [
            'driver' => 'local',
            'root' => public_path('/'),
            //'url' => url('/'),
            'url' => '/',
            'visibility' => 'public',
        ],

        'cache' => [
            'driver' => 'local',
            //'root' => storage_path('app/public'),
            //'root' => base_path('../cache'),
            'root' => '/tmp',
            //'url' => env('APP_URL').'/storage',
            'visibility' => 'public',
        ],

        's3' => [
            'driver' => 's3',
            'key' => env('AWS_ACCESS_KEY_ID'),
            'secret' => env('AWS_SECRET_ACCESS_KEY'),
            'region' => env('AWS_DEFAULT_REGION'),
            'bucket' => env('AWS_BUCKET'),
            'url' => env('AWS_URL'),
        ],
    ],
];

database.php

<?php

return [
    'connections' => [
        'mysql' => [
            'driver' => 'mysql',
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            //'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'strict' => false,
            'engine' => null,
        ],

        'liveuser_general' => [
            'driver' => 'mysql',
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '3306'),
            //'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',
            'database' => env('DB_DATABASE_LU', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'strict' => false,
            'engine' => null,
        ],

        'sqlite' => [
            'driver' => 'sqlite',
            'url' => env('DATABASE_URL'),
            'database' => env('DB_DATABASE', database_path('database.sqlite')),
            'prefix' => '',
            'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
        ],
    ], //end connections
];

auth.php

<?php

return [
    /*
    |--------------------------------------------------------------------------
    | Authentication Defaults
    |--------------------------------------------------------------------------
    |
    | This option controls the default authentication "guard" and password
    | reset options for your application. You may change these defaults
    | as required, but they're a perfect start for most applications.
    |
    */

    'defaults' => [
        'guard' => 'web',
        'passwords' => 'users',
    ],

    /*
    |--------------------------------------------------------------------------
    | Authentication Guards
    |--------------------------------------------------------------------------
    |
    | Next, you may define every authentication guard for your application.
    | Of course, a great default configuration has been defined for you
    | here which uses session storage and the Eloquent user provider.
    |
    | All authentication drivers have a user provider. This defines how the
    | users are actually retrieved out of your database or other storage
    | mechanisms used by this application to persist your user's data.
    |
    | Supported: "session", "token"
    |
    */

    'guards' => [
        'web' => [
            'driver' => 'session',
            'provider' => 'users',
        ],

        'api' => [
            'driver' => 'token',
            'provider' => 'users',
            'hash' => false,
        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | User Providers
    |--------------------------------------------------------------------------
    |
    | All authentication drivers have a user provider. This defines how the
    | users are actually retrieved out of your database or other storage
    | mechanisms used by this application to persist your user's data.
    |
    | If you have multiple user tables or models you may configure multiple
    | sources which represent each model / table. These sources may then
    | be assigned to any extra authentication guards you have defined.
    |
    | Supported: "database", "eloquent"
    |
    */

    'providers' => [
        'users' => [
            'driver' => 'eloquent',
            'model' => Modules\LU\Models\User::class,
        ],
    ],

    /*
    |--------------------------------------------------------------------------
    | Resetting Passwords
    |--------------------------------------------------------------------------
    |
    | You may specify multiple password reset configurations if you have more
    | than one user table or model in the application and you want to have
    | separate password reset settings based on the specific user types.
    |
    | The expire time is the number of minutes that the reset token should be
    | considered valid. This security feature keeps tokens short-lived so
    | they have less time to be guessed. You may change this as needed.
    |
    */

    'passwords' => [
        'users' => [
            'provider' => 'users',
            'table' => 'password_resets',
            'expire' => 60,
            'email' => 'lu::auth.emails.password',
            'connection' => 'liveuser_general',
        ],
    ],
];

menu_aside.php (wip)

menu_header.php (wip)

layouts.php (wip)

File migration

Cancellare i file migration che si trovano dentro laravel\database\migrations