vanilophp / order

Order Module For Vanilo (Laravel)
https://vanilo.io
MIT License
34 stars 3 forks source link

use Order out of vanilophp #2

Closed mohamedaitbella closed 5 years ago

mohamedaitbella commented 5 years ago

im trying to use this module out of vanilophp but there is no migration 1- is it fine to use order as standalone model ? 2- where i can find migrations ? this model does not have it's own migration thanks you for the hard work .

fulopattila122 commented 5 years ago

1.) yes this is completely fine, the module was designed to be usable standalone. 2.) Migrations are in the src/resources/database/migrations folder.

They get automatically registered if you properly boot the module:

  1. Install the order module with composer:

    composer require vanilo/order
  2. Add the module to config/concord.php:

    
    <?php

return [ 'modules' => [ Vanilo\Order\Providers\ModuleServiceProvider::class ] ];



To get you on the right path, please read these sections, it takes 10 minutes and they're crucial:
https://vanilo.io/docs/0.4/modules-vs-framework
https://vanilo.io/docs/0.4/concord
https://vanilo.io/docs/0.4/models
https://vanilo.io/docs/0.4/orders
mohamedaitbella commented 5 years ago

thank you for your prompt reply

let me please share what i did maybe maybe i forget something or something is missing at least for me . **- im working on larave 5.7 php 7.2 what i did / steps to reproduce error

  1. Install the order module with composer: composer require konekt/concord composer require vanilo/order
  2. order is requiring this table befor order migrations so i did the migration country and addresses

screenshot 3

i escapte this error by doing it manialy

enum type ['billing','business','contract','mailing','pickup','residential','shipping','']

  1. step 3 php artisan vendor:publish --provider="Konekt\Concord\ConcordServiceProvider" --tag=config

return [ 'modules' => [ Vanilo\Order\Providers\ModuleServiceProvider::class ] ];

and lastly run order migration ' php artisan migrate '

now it give me this error

screenshot 4

yusufkandemir commented 5 years ago

Advice

order is requiring this table befor order migrations so i did the migration country and addresses i escapte this error by doing it manialy enum type ['billing','business','contract','mailing','pickup','residential','shipping','']

You must add konekt/address module to fix that error, don't do it manually. konekt/address is already a dependency for vanilo/order so you don't need to add it with composer. But you must add the module to config/concord.php like so:

<?php

return [
    'modules' => [
        Vanilo\Order\Providers\ModuleServiceProvider::class,
        Konekt\Address\Providers\ModuleServiceProvider::class,
    ]
];

The Fix

now it give me this error

FQN(Fully Qualified Name) for Order model is

Vanilo\Order\Models\Order

not

Vanilo\Order\Model\Order

s is missing.

Extra Note for Laravel 5.8+ Users

You need to change bigIncrements

Schema::create('users', function (Blueprint $table) {
            $table->bigIncrements('id');
            ...

to increments

Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            ...

in users migration.

Or if you want to keep it that way, you can change every $table->integer('user_id')->unsigned() in module migrations to $table->bigInteger('user_id')->unsigned(). This can be changed in the near future, you can follow this issue.

fulopattila122 commented 5 years ago

The bigInteger issue is gone now, you could either upgrade the Order module to 0.5.2 or to 1.0@dev

The safest way is to run:

composer update vanilo/order