0

I just have a theme built with Laravel and I wonder if I decided to sell it how the client will install it and how he will migrate the database and insert the admin data?

I can do it by exporting and importing database from phpmyadmin but I think it's not the right way for clients.

How to deal with client?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Aymen bz
  • 368
  • 1
  • 5
  • 10
  • 1
    depending on where the client will install Laravel app, You could make an artisan command for setting up your theme. Consider writing a documentation for your theme with all the instruction. – Emeka Mbah Aug 24 '17 at 12:40
  • 4
    Do Not Pay Attention Just Want To Try It Myself – TGrif Aug 24 '17 at 13:31

5 Answers5

1

If you just want to allow client to easily import your database, you can give a look to Laravel Migration.

Also if you want to add some data you can give a look to this answer.

Then the client will just need to do php artisan migrate from the root directory of the project.

  • Thanks for your answer ... i'm asking how the client will install the project in shared host? – Aymen bz Aug 24 '17 at 12:42
  • If the project is a full Laravel app you can put your code on github or something like that. The client will just need to clone the repo. Also Ian Rodrigues give you a good solution with the packages. – Benjamin Brasseur Aug 24 '17 at 12:54
1

You can create migration using this command

The --table and --create options may also be used to indicate the name of the table and whether the migration will be creating a new table. These options simply pre-fill the generated migration stub file with the specified table:

php artisan make:migration create_users_table --create=users

php artisan make:migration add_votes_to_users_table --table=users

Now for inserting data you can use Seeder To generate a seeder, execute the make:seeder Artisan command. All seeders generated by the framework will be placed in the database/seeds directory:

php artisan make:seeder UsersTableSeeder

Client side

Installation

  • There are several ways of downloading the application:

Use GitHub: simply click the Clone or download button at the top right of this page and choose Download ZIP Use Git: git clone https://github.com/austintoddj/canvas.git

  • Run composer install from the command line in the project root.
  • Run npm install from the command line in the project root if you installed any additional packages.
  • Run php artisan migrate to install migrations
  • php artisan db:seed to seed your tables

Copy the contents of .env.example and create a new file called .env in the project root. Set your application variables in the new file. Be sure to keep the value of APP_ENV set to local for the duration of the install.

Run php artisan canvas:install and follow the on-screen prompts.

l.g.karolos
  • 1,131
  • 1
  • 10
  • 25
1

You could export it as a package, set up your composer.json, create a YourPackageServiceProvider to boot and register your pieces of code like migrations, views, routes, etc. You can though create a command like php artisan your-package:install that will wrap all of the steps to get the package installed properly.

So in order to get your package installed your client will:

Install the package via composer

composer require `your-namespace\your-package`

Register the Service Provider(in Laravel 5.5 you can use auto-discovery) and then:

php artisan your-package:install

You can look at Voyager as a good example.

Ian Rodrigues
  • 743
  • 5
  • 21
1

In my perspective client should not handle any code staff or command line commands, so what I'm doing in my projects is showing the user the installer pages :

1 - the first page is validate system configurations (PHP version, composer requirements, any more requirements...) and showing him what he needs to  have in his machine

2 - after the system requirement, I check if the database exists if I give the option to create it for him or if the client needs to give the name of the DB

3 - after that all the installations that will happen in the background
Ayoub ait
  • 163
  • 2
  • 4
0

If you want to install external packages in any version of Laravel then you have to add the service provider to the config/app.php file in the providers array. for example: if we install voyager package then we have to add TCG\Voyager\VoyagerServiceProvider::class, like this

'providers' => [
    // Laravel Framework Service Providers...
    //...

    // Package Service Providers
    TCG\Voyager\VoyagerServiceProvider::class,
    // ...

    // Application Service Providers
    // ...
],