Commit ded198d3 by Francisco Salazar

Initial commit

parents
# Package products OneStartup
**onestartup/product** is a module product for websites
# Installation
- Run this in the terminal
```php
composer require onestartup/product
```
- after add the ServiceProvider to the providers array in config/app.php
```php
Onestartup\Product\ProductServiceProvider::class,
```
- Run migration
```php
php artisan migrate
```
- add next lines to app/User.php
```php
public function products()
{
return $this->hasMany('Onestartup\Product\Model\Product', 'user_id');
}
```
- run command for publish views
```php
php artisan vendor:publish --provider="Onestartup\Product\ProductServiceProvider"
```
- run command for publish config file
```php
php artisan vendor:publish --tag=config
```
- run serv
```php
php artisan serve
```
- test in this route how admin user
```php
http://localhost:8000/admin/product/product
```
- add .env vars
```php
SLUG_PRODUCTS=productos
SLUG_PRODUCTS_CATEGORY=categorias
```
- test in this route
```php
http://localhost:8000/portafolio
```
\ No newline at end of file
{
"name": "onestartup/product-primerplano",
"description": "catalog of products for websites onestartup",
"type": "library",
"license": "Apache-2.0",
"authors": [
{
"name": "Francisco Salazar",
"email": "[email protected]"
}
],
"minimum-stability": "dev",
"require": {},
"autoload": {
"psr-4": {"Onestartup\\ProductPrimerPlano\\": "src"}
}
}
<?php
namespace Onestartup\ProductPrimerPlano;
use Illuminate\Support\ServiceProvider;
class ProductPrimerPlanoServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
include __DIR__.'/routes.php';
$this->loadMigrationsFrom(__DIR__.'/migrations');
if (is_dir(base_path() . '/resources/views/vendor/onestartup/product')) {
$this->loadViewsFrom(base_path() . '/resources/views/vendor/onestartup/product', 'product-public');
$this->loadViewsFrom(__DIR__.'/views', 'product');
} else {
$this->loadViewsFrom(__DIR__.'/views', 'product');
$this->loadViewsFrom(__DIR__.'/views/public', 'product-public');
}