# Installation

The instructions below will help you to properly installand run the generated package to the lavalite project.

## Location

Extract the package contents to the folder 

`/packages/lotto/lottery_spell/`

## Composer

Add the below entries in the `composer.json`.


```json

...
     "repositories": {
        ...

        {
            "type": "path",
            "url": "packages/lotto/lottery_spell"
        }

        ...
    },
...

```
Then run `composer require lotto/lottery_spell`


## Migration and seeds

```
    php artisan migrate
    php artisan db:seed --class=Lotto\\LotterySpell\\Seeders\\LotterySpellTableSeeder
```

## Publishing

* Configuration
```
    php artisan vendor:publish --provider="Lotto\LotterySpell\Providers\LotterySpellServiceProvider" --tag="config"
```
* Language
```
    php artisan vendor:publish --provider="Lotto\LotterySpell\Providers\LotterySpellServiceProvider" --tag="lang"
```
* Views
```
    php artisan vendor:publish --provider="Lotto\LotterySpell\Providers\LotterySpellServiceProvider" --tag="view"
```

## URLs and APIs

### Web Urls

* Admin
```
    http://path-to-route-folder/admin/lottery_spell/{modulename}
```

* User
```
    http://path-to-route-folder/user/lottery_spell/{modulename}
```

* Public
```
    http://path-to-route-folder/lottery_spells
```


### API endpoints

These endpoints can be used with or without `/api/`
And also the user can be varied depend on the type of users, eg user, client, admin etc.

#### Resource

* List
```
    http://path-to-route-folder/api/user/lottery_spell/{modulename}
    METHOD: GET
```

* Create
```
    http://path-to-route-folder/api/user/lottery_spell/{modulename}
    METHOD: POST
```

* Edit
```
    http://path-to-route-folder/api/user/lottery_spell/{modulename}/{id}
    METHOD: PUT
```

* Delete
```
    http://path-to-route-folder/api/user/lottery_spell/{modulename}/{id}
    METHOD: DELETE
```

#### Public

* List
```
    http://path-to-route-folder/api/lottery_spell/{modulename}
    METHOD: GET
```

* Single Item
```
    http://path-to-route-folder/api/lottery_spell/{modulename}/{slug}
    METHOD: GET
```

#### Others

* Report
```
    http://path-to-route-folder/api/user/lottery_spell/{modulename}/report/{report}
    METHOD: GET
```

* Export/Import
```
    http://path-to-route-folder/api/user/lottery_spell/{modulename}/exim/{exim}
    METHOD: POST
```

* Action
```
    http://path-to-route-folder/api/user/lottery_spell/{modulename}/action/{id}/{action}
    METHOD: PATCH
```

* Actions
```
    http://path-to-route-folder/api/user/lottery_spell/{modulename}/actions/{action}
    METHOD: PATCH
```

* Workflow
```
    http://path-to-route-folder/api/user/lottery_spell/{modulename}/workflow/{id}/{transition}
    METHOD: PATCH
```