-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Activar tiendas, configuracion de observer
- Loading branch information
1 parent
69fce7a
commit 34e1e2d
Showing
16 changed files
with
317 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,57 +4,77 @@ | |
|
||
Repositorio de respaldo para el tutorial **[Multi Seller Ecommerce](https://www.youtube.com/playlist?list=PLzz9vf6075V2xMDgFzAE_j2tug2Vwx9u-)** del canal de youtube de __[WebDevMatics](https://www.youtube.com/channel/UCjpCwTGrMRuTi4FcrCYbkSQ)__ | ||
|
||
### Requisitos | ||
|
||
- PHP >= 7.2.5 | ||
- [Composer](https://getcomposer.org) | ||
|
||
### Instalar y configurar el proyecto | ||
|
||
- Ejecutar el comando **_composer install_** para instalar las dependecnias PHP de Laravel | ||
- Clonar repositorio e ingresar al directorio principal | ||
`cd webmall` | ||
- Crear una base de datos en MySQL | ||
- Copiar o renombrar el archivo **_.env.example_** a **_.env_** y agregar la conexión a la base de de datos | ||
- Ejecutar el comando **_php artisan migrate_** para crear las tablas en la base de deatos | ||
- Ejecutar el comando **_php artisan db:seed_** para generar los registros base del administrador | ||
- Ejecutar el comando **_npm install && npm run dev_** para compilar los scripts JS y estilos CSS | ||
- Ejecutar el comando **_php artisan serve_** para abrir el proyecto en el servidor local | ||
- Copiar ó renombrar el archivo __*.env.example*__ a __*.env*__ | ||
`cp .env.example .env` | ||
- Agregar la conexión a la base de de datos en **_.env_**: | ||
_DB_CONNECTION=mysql_ | ||
_DB_HOST=127.0.0.1_ | ||
_DB_PORT=3306_ | ||
_DB_DATABASE=_**_Tu_base_de_datos_va_aquí_** | ||
_DB_USERNAME=_**_Tus_credenciales_van_aquí_** | ||
_DB_PASSWORD=_**_Tus_credenciales_van_aquí_** | ||
- Ejecutar los comandos: | ||
`composer install` (instalar dependencias de Laravel) | ||
`php artisan migrate` (crear tablas en la base de datos) | ||
`php artisan db:seed` (generar registros base del administrador) | ||
`npm install && npm run dev` (compilar los scripts JS y estilos CSS) | ||
`php artisan serve` (iniciar proyecto en servidor local) | ||
- Ingresar a la url **_http://127.0.0.1:8000_** para ver la tienda | ||
- Ingresar a la url **_http://127.0.0.1:8000/admin_** para ver el administrador de de la tienda | ||
- Ingresar a la url **_http://127.0.0.1:8000/admin_** para ver el administrador | ||
|
||
### Credenciales | ||
|
||
- Usuario cliente: | ||
- **Usuario cliente:** | ||
email: _[email protected]_ | ||
password: _12345678_ | ||
|
||
- Usuario administrador: | ||
password: _[email protected]_ | ||
- **Usuario vendedor:** | ||
email: _[email protected]_ | ||
password: _12345678_ | ||
|
||
- **Usuario administrador:** | ||
email: _[email protected]_ | ||
password: _12345678_ | ||
|
||
## Configuraciones adicionales para probar la tienda | ||
|
||
### Probar compras a traves de **__Paypal__** [**[API Paypal](https://developer.paypal.com)**] | ||
|
||
- Generar llaves de la API de Paypal y agregarlas al archivo .ENV usando las siguientes lineas: | ||
#PayPal Setting & API Credentials - sandbox | ||
PAYPAL_SANDBOX_API_USERNAME=**_Tus_llaves_van_aqui_** | ||
PAYPAL_SANDBOX_API_PASSWORD=**_Tus_llaves_van_aqui_** | ||
PAYPAL_SANDBOX_API_SECRET=**_Tus_llaves_van_aqui_** | ||
PAYPAL_SANDBOX_API_CERTIFICATE= | ||
_#PayPal Setting & API Credentials - sandbox_ | ||
_PAYPAL_SANDBOX_API_USERNAME=_**_Tus_llaves_van_aquí_** | ||
_PAYPAL_SANDBOX_API_PASSWORD=_**_Tus_llaves_van_aquí_** | ||
_PAYPAL_SANDBOX_API_SECRET=_**_Tus_llaves_van_aquí_** | ||
_PAYPAL_SANDBOX_API_CERTIFICATE=_ | ||
|
||
### Probar notificación de pagos [**[Mailtrap](https://mailtrap.io)**] | ||
|
||
- Generar credenciales de SMTP en Mailtrap y agregarlas al archivo .ENV usando las siguientes lineas: | ||
MAIL_MAILER=smtp | ||
MAIL_HOST=smtp.mailtrap.io | ||
MAIL_PORT=2525 | ||
MAIL_USERNAME=**_Tus_credenciales_van_aqui_** | ||
MAIL_PASSWORD=**_Tus_credenciales_van_aqui_** | ||
MAIL_ENCRYPTION=null | ||
MAIL_FROM_ADDRESS=webmall@webmall.dev | ||
MAIL_FROM_NAME="${APP_NAME}" | ||
_MAIL_MAILER=smtp_ | ||
_MAIL_HOST=smtp.mailtrap.io_ | ||
_MAIL_PORT=2525_ | ||
_MAIL_USERNAME=_**_Tus_credenciales_van_aquí_** | ||
_MAIL_PASSWORD=_**_Tus_credenciales_van_aquí_** | ||
_MAIL_ENCRYPTION=null_ | ||
_MAIL_FROM_ADDRESS=webmall@webmall.dev_ | ||
_MAIL_FROM_NAME=Webmall_ | ||
|
||
## Paquetes usados | ||
|
||
- **[laravel-paypal](https://github.com/srmklive/laravel-paypal)** Pagos a traves de Paypal | ||
- [**[laravel-paypal](https://github.com/srmklive/laravel-paypal)**] Pagos a traves de Paypal | ||
|
||
- **[voyager](https://voyager-docs.devdojo.com/getting-started/installation)** Panel de administración | ||
- [**[voyager](https://voyager-docs.devdojo.com/getting-started/installation)**] Panel de administración | ||
|
||
- **[iseed](https://github.com/orangehill/iseed)** Generar backup inverso para las seeds de la base de datos | ||
- [**[iseed](https://github.com/orangehill/iseed)**] Generar backup inverso para las seeds de la base de datos | ||
|
||
## [Documentación Laravel 7](https://laravel.com/docs) | ||
### [Licencia MIT](https://github.com/alejandro-ser/webmall/blob/master/LICENSE) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace App\Mail; | ||
|
||
use App\Shop; | ||
use Illuminate\Bus\Queueable; | ||
use Illuminate\Mail\Mailable; | ||
use Illuminate\Queue\SerializesModels; | ||
use Illuminate\Contracts\Queue\ShouldQueue; | ||
|
||
class ShopActivated extends Mailable | ||
{ | ||
use Queueable, SerializesModels; | ||
|
||
public $shop; | ||
|
||
/** | ||
* Create a new message instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct(Shop $shop) | ||
{ | ||
$this->shop = $shop; | ||
} | ||
|
||
/** | ||
* Build the message. | ||
* | ||
* @return $this | ||
*/ | ||
public function build() | ||
{ | ||
return $this->markdown('mail.customer.shop-activated'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<?php | ||
|
||
namespace App\Observers; | ||
|
||
use App\Shop; | ||
use App\Mail\ShopActivated; | ||
use Illuminate\Support\Facades\Mail; | ||
|
||
class ShopObserver | ||
{ | ||
/** | ||
* Handle the shop "created" event. | ||
* | ||
* @param \App\Shop $shop | ||
* @return void | ||
*/ | ||
public function created(Shop $shop) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Handle the shop "updated" event. | ||
* | ||
* @param \App\Shop $shop | ||
* @return void | ||
*/ | ||
public function updated(Shop $shop) | ||
{ | ||
// check if active column is changed from inactive to active | ||
|
||
if ($shop->getOriginal('is_active') == false && $shop->is_active == true) { | ||
// send mail to customer | ||
Mail::to($shop->owner->email)->send(new ShopActivated($shop)); | ||
|
||
// change role from customer to seller | ||
$shop->owner->setRole('seller'); | ||
} | ||
} | ||
|
||
/** | ||
* Handle the shop "deleted" event. | ||
* | ||
* @param \App\Shop $shop | ||
* @return void | ||
*/ | ||
public function deleted(Shop $shop) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Handle the shop "restored" event. | ||
* | ||
* @param \App\Shop $shop | ||
* @return void | ||
*/ | ||
public function restored(Shop $shop) | ||
{ | ||
// | ||
} | ||
|
||
/** | ||
* Handle the shop "force deleted" event. | ||
* | ||
* @param \App\Shop $shop | ||
* @return void | ||
*/ | ||
public function forceDeleted(Shop $shop) | ||
{ | ||
// | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.