Skip to content

Instantly share code, notes, and snippets.

View henriqueweiand's full-sized avatar

Henrique Weiand henriqueweiand

View GitHub Profile
import { Module } from '@nestjs/common';
import { CacheManagerModule } from '@app/infra/persistence/cache/cache.module';
import { OrderController } from './order.controller';
import { ProductController } from './product.controller';
import { UserController } from './user.controller';
import { CreateOrderUseCase } from '@app/application/ecommerce/use-case/create-order';
import { CreateProductUseCase } from '@app/application/ecommerce/use-case/create-product';
import { CreateUserUseCase } from '@app/application/ecommerce/use-case/create-user';
import { GetOrderUseCase } from '@app/application/ecommerce/use-case/get-order';
import { Entity } from "@app/core/entities/entity";
export interface ProductProps {
id?: string
title: string
price: number
}
export class Product extends Entity<ProductProps> {
constructor(props: ProductProps) {
const trx = await Database.beginTransaction();
const user = await User.findOrFail(id);
if (!user) {
throw new JsonException('Usuário não localizado', 400);
}
try {
await user.merge(data);
const { test, trait, beforeEach } = use('Test/Suite')('User registration');
const Factory = use('Factory');
const Database = use('Database');
const User = use('App/Models/User');
const Permissions = use('App/Models/Permissions');
const UserService = use('App/Services/UserService');
const userService = new UserService();
trait('DatabaseTransactions');
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
APP_NAME=Lumen
APP_ENV=local
APP_KEY=11111111111111111111111111111111
APP_DEBUG=true
APP_URL=http://localhost
APP_TIMEZONE=UTC
LOG_CHANNEL=stack
LOG_SLACK_WEBHOOK_URL=
<?php
$factory->define(App\Users::class, function (Faker\Generator $faker) {
return [
'name' => $faker->name,
'lastname' => $faker->lastName,
'email' => $faker->email,
'telephone' => $faker->phoneNumber,
];
});
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateMessagesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
<?php namespace App;
use Illuminate\Database\Eloquent\Model;
class Messages extends Model {
protected $fillable = [
"id",
"user_id",
"description",
"created_at",
"updated_at"
];