Migrations, models and login changes were developed.
This commit is contained in:
parent
8a6caeca84
commit
cb407102d2
38
app/Actions/UserAction.php
Normal file
38
app/Actions/UserAction.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions;
|
||||
|
||||
use App\Interface\ActionInterface;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class UserAction implements ActionInterface
|
||||
{
|
||||
|
||||
public function list(): User
|
||||
{
|
||||
return User::all();
|
||||
}
|
||||
|
||||
public function create(array $params): Builder|Model
|
||||
{
|
||||
return User::query()->create($params);
|
||||
}
|
||||
|
||||
public function show($id): User
|
||||
{
|
||||
return User::query()->find($id);
|
||||
}
|
||||
|
||||
public function update(array $params, $id): int
|
||||
{
|
||||
return User::query()->find($id)->update($params);
|
||||
}
|
||||
|
||||
public function delete($id)
|
||||
{
|
||||
// TODO: Implement delete() method.
|
||||
}
|
||||
}
|
||||
60
app/Http/Controllers/Auth/AuthController.php
Normal file
60
app/Http/Controllers/Auth/AuthController.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\LoginResquest;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Laravel\Sanctum\PersonalAccessToken;
|
||||
|
||||
class AuthController extends Controller
|
||||
{
|
||||
public function login(LoginResquest $request)
|
||||
{
|
||||
$credentials = $request->only('email', 'password');
|
||||
|
||||
if (!auth()->attempt($credentials))
|
||||
{
|
||||
abort(401, 'Inavalid Credentials');
|
||||
}
|
||||
|
||||
$user = auth()->user();
|
||||
$token = $user->createToken('API Token');
|
||||
|
||||
return response()->json([
|
||||
'token' => $token->plainTextToken,
|
||||
'user' => $user
|
||||
], 200);
|
||||
|
||||
}
|
||||
|
||||
public function login2(LoginResquest $request): JsonResponse
|
||||
{
|
||||
$credentials = $request->only('email', 'password');
|
||||
|
||||
if (!auth()->attempt($credentials))
|
||||
{
|
||||
abort(401, 'Inavalid Credentials');
|
||||
}
|
||||
|
||||
$request->session()->regenerate();
|
||||
|
||||
return response()->json([], 200);
|
||||
|
||||
}
|
||||
|
||||
public function logout(Request $request): JsonResponse
|
||||
{
|
||||
$requestToken = $request->header('authorization');
|
||||
|
||||
$token = (new PersonalAccessToken())
|
||||
->findToken(str_replace('Bearer ','', $requestToken));
|
||||
|
||||
$token->delete();
|
||||
|
||||
return response()->json([
|
||||
'message' => 'Roken Revoked.'
|
||||
], 200);
|
||||
}
|
||||
}
|
||||
14
app/Http/Controllers/Auth/RegisterController.php
Normal file
14
app/Http/Controllers/Auth/RegisterController.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class RegisterController extends Controller
|
||||
{
|
||||
public function store()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
26
app/Http/Controllers/EconomyController.php
Normal file
26
app/Http/Controllers/EconomyController.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\DadosCadastrais;
|
||||
use App\Models\Economy;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Symfony\Component\HttpFoundation\Response as ResponseAlias;
|
||||
|
||||
class EconomyController extends Controller
|
||||
{
|
||||
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
|
||||
abort_if(Gate::denies('teste-index'), ResponseAlias::HTTP_FORBIDDEN, '403 Forbidden');
|
||||
|
||||
$result = DadosCadastrais::query()->limit(10)->get();
|
||||
|
||||
return response()->json($result, 200);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
10
app/Http/Controllers/FaqController.php
Normal file
10
app/Http/Controllers/FaqController.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class FaqController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
8
app/Http/Controllers/NewsController.php
Normal file
8
app/Http/Controllers/NewsController.php
Normal file
@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
class NewsController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
63
app/Http/Controllers/PermissionController.php
Normal file
63
app/Http/Controllers/PermissionController.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class PermissionController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
63
app/Http/Controllers/RoleController.php
Normal file
63
app/Http/Controllers/RoleController.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class RoleController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
71
app/Http/Controllers/UserController.php
Normal file
71
app/Http/Controllers/UserController.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Actions\UserAction;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function index(): JsonResponse
|
||||
{
|
||||
try {
|
||||
$list = (new UserAction())->list();
|
||||
return response()->json($list, 200);
|
||||
}catch (\Exception $ex){
|
||||
return response()->json(['message' => $ex->getMessage()], 500);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
31
app/Http/Requests/LoginResquest.php
Normal file
31
app/Http/Requests/LoginResquest.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class LoginResquest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'email' => 'required|string|email',
|
||||
'password' => 'required|string|min:6',
|
||||
];
|
||||
}
|
||||
}
|
||||
30
app/Http/Requests/RegisterUserResquest.php
Normal file
30
app/Http/Requests/RegisterUserResquest.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class RegisterUserResquest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
30
app/Http/Requests/UserLoginRequest.php
Normal file
30
app/Http/Requests/UserLoginRequest.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UserLoginRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
13
app/Interface/ActionInterface.php
Normal file
13
app/Interface/ActionInterface.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Interface;
|
||||
|
||||
interface ActionInterface
|
||||
{
|
||||
public function list();
|
||||
public function create(array $params);
|
||||
public function show($id);
|
||||
public function update(array $params, $id);
|
||||
public function delete($id);
|
||||
|
||||
}
|
||||
16
app/Models/DadosCadastrais.php
Normal file
16
app/Models/DadosCadastrais.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use OwenIt\Auditing\Contracts\Auditable as Auditing;
|
||||
use OwenIt\Auditing\Auditable;
|
||||
|
||||
class DadosCadastrais extends Model implements Auditing
|
||||
{
|
||||
use HasFactory, SoftDeletes, Auditable;
|
||||
|
||||
protected $table = 'dados_cadastrais';
|
||||
}
|
||||
15
app/Models/DadosTe.php
Normal file
15
app/Models/DadosTe.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use OwenIt\Auditing\Contracts\Auditable as Auditing;
|
||||
use OwenIt\Auditing\Auditable;
|
||||
|
||||
|
||||
class DadosTe extends Model implements Auditing
|
||||
{
|
||||
use HasFactory, SoftDeletes, Auditable;
|
||||
}
|
||||
17
app/Models/Economy.php
Normal file
17
app/Models/Economy.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use OwenIt\Auditing\Contracts\Auditable as Auditing;
|
||||
use OwenIt\Auditing\Auditable;
|
||||
|
||||
|
||||
class Economy extends Model implements Auditing
|
||||
{
|
||||
use HasFactory, SoftDeletes, Auditable;
|
||||
|
||||
protected $table = 'economia';
|
||||
}
|
||||
14
app/Models/Faq.php
Normal file
14
app/Models/Faq.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use OwenIt\Auditing\Contracts\Auditable as Auditing;
|
||||
use OwenIt\Auditing\Auditable;
|
||||
|
||||
class Faq extends Model implements Auditing
|
||||
{
|
||||
use HasFactory, SoftDeletes, Auditable;
|
||||
}
|
||||
15
app/Models/Med5min.php
Normal file
15
app/Models/Med5min.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use OwenIt\Auditing\Contracts\Auditable as Auditing;
|
||||
use OwenIt\Auditing\Auditable;
|
||||
|
||||
|
||||
class Med5min extends Model implements Auditing
|
||||
{
|
||||
use HasFactory, SoftDeletes, Auditable;
|
||||
}
|
||||
19
app/Models/News.php
Normal file
19
app/Models/News.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use OwenIt\Auditing\Contracts\Auditable as Auditing;
|
||||
use OwenIt\Auditing\Auditable;
|
||||
|
||||
class News extends Model implements Auditing
|
||||
{
|
||||
use HasFactory, SoftDeletes, Auditable;
|
||||
|
||||
protected $fillable = [
|
||||
'title',
|
||||
'text'
|
||||
];
|
||||
}
|
||||
11
app/Models/Notifications.php
Normal file
11
app/Models/Notifications.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Notifications extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
11
app/Models/Parameters.php
Normal file
11
app/Models/Parameters.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Parameters extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
}
|
||||
12
app/Models/Permission.php
Normal file
12
app/Models/Permission.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Permission extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
}
|
||||
15
app/Models/Pld.php
Normal file
15
app/Models/Pld.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use OwenIt\Auditing\Contracts\Auditable as Auditing;
|
||||
use OwenIt\Auditing\Auditable;
|
||||
|
||||
|
||||
class Pld extends Model implements Auditing
|
||||
{
|
||||
use HasFactory, SoftDeletes, Auditable;
|
||||
}
|
||||
35
app/Models/Role.php
Normal file
35
app/Models/Role.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use OwenIt\Auditing\Contracts\Auditable as Auditing;
|
||||
use OwenIt\Auditing\Auditable;
|
||||
|
||||
class Role extends Model implements Auditing
|
||||
{
|
||||
use HasFactory, SoftDeletes, Auditable;
|
||||
|
||||
public $table = 'roles';
|
||||
|
||||
protected $dates = [
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
public function permissions(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Permission::class);
|
||||
}
|
||||
}
|
||||
@ -2,15 +2,18 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
use OwenIt\Auditing\Contracts\Auditable as Auditing;
|
||||
use OwenIt\Auditing\Auditable;
|
||||
|
||||
class User extends Authenticatable
|
||||
class User extends Authenticatable implements Auditing
|
||||
{
|
||||
use HasApiTokens, HasFactory, Notifiable;
|
||||
use HasApiTokens, HasFactory, Notifiable, SoftDeletes, Auditable;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
@ -21,6 +24,9 @@ class User extends Authenticatable
|
||||
'name',
|
||||
'email',
|
||||
'password',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'deleted_at',
|
||||
];
|
||||
|
||||
/**
|
||||
@ -41,4 +47,10 @@ class User extends Authenticatable
|
||||
protected $casts = [
|
||||
'email_verified_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function roles(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Role::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -21,10 +21,12 @@ class AuthServiceProvider extends ServiceProvider
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
public function boot(): void
|
||||
{
|
||||
$this->registerPolicies();
|
||||
|
||||
//
|
||||
Gate::define('teste-index', function ($user){
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,15 +5,16 @@
|
||||
"keywords": ["framework", "laravel"],
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.0.2",
|
||||
"php": "^8.1",
|
||||
"guzzlehttp/guzzle": "^7.2",
|
||||
"laravel/framework": "^9.11",
|
||||
"laravel/sanctum": "^2.14.1",
|
||||
"laravel/tinker": "^2.7"
|
||||
"laravel/tinker": "^2.7",
|
||||
"owen-it/laravel-auditing": "^13.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"fakerphp/faker": "^1.9.1",
|
||||
"laravel/sail": "^1.0.1",
|
||||
"laravel/sail": "^1.14.2",
|
||||
"mockery/mockery": "^1.4.4",
|
||||
"nunomaduro/collision": "^6.1",
|
||||
"phpunit/phpunit": "^9.5.10",
|
||||
|
||||
142
composer.lock
generated
142
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "1abc7822bd9f28e9a62986817bf04f76",
|
||||
"content-hash": "8d22be6a885e9930e292c80a7eee9a14",
|
||||
"packages": [
|
||||
{
|
||||
"name": "brick/math",
|
||||
@ -895,16 +895,16 @@
|
||||
},
|
||||
{
|
||||
"name": "laravel/framework",
|
||||
"version": "v9.12.1",
|
||||
"version": "v9.12.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laravel/framework.git",
|
||||
"reference": "7c8bf052ef4919b8ffa7f25ec6f8648c4a36fc57"
|
||||
"reference": "b5b5c635f1a93f277b5248725a1f7ffc97e20810"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/7c8bf052ef4919b8ffa7f25ec6f8648c4a36fc57",
|
||||
"reference": "7c8bf052ef4919b8ffa7f25ec6f8648c4a36fc57",
|
||||
"url": "https://api.github.com/repos/laravel/framework/zipball/b5b5c635f1a93f277b5248725a1f7ffc97e20810",
|
||||
"reference": "b5b5c635f1a93f277b5248725a1f7ffc97e20810",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1070,7 +1070,7 @@
|
||||
"issues": "https://github.com/laravel/framework/issues",
|
||||
"source": "https://github.com/laravel/framework"
|
||||
},
|
||||
"time": "2022-05-10T19:32:47+00:00"
|
||||
"time": "2022-05-11T13:38:26+00:00"
|
||||
},
|
||||
{
|
||||
"name": "laravel/sanctum",
|
||||
@ -2002,6 +2002,94 @@
|
||||
},
|
||||
"time": "2021-11-30T19:35:32+00:00"
|
||||
},
|
||||
{
|
||||
"name": "owen-it/laravel-auditing",
|
||||
"version": "v13.0.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/owen-it/laravel-auditing.git",
|
||||
"reference": "332d136a7d67a2c06ee85aa17efeafb3ba25c972"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/owen-it/laravel-auditing/zipball/332d136a7d67a2c06ee85aa17efeafb3ba25c972",
|
||||
"reference": "332d136a7d67a2c06ee85aa17efeafb3ba25c972",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-json": "*",
|
||||
"illuminate/console": "^7.0|^8.0|^9.0",
|
||||
"illuminate/database": "^7.0|^8.0|^9.0",
|
||||
"illuminate/filesystem": "^7.0|^8.0|^9.0",
|
||||
"php": "^7.3|^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"laravel/legacy-factories": "*",
|
||||
"mockery/mockery": "^1.0",
|
||||
"orchestra/testbench": "^5.0|^6.0|^7.0",
|
||||
"phpunit/phpunit": "^9.0"
|
||||
},
|
||||
"suggest": {
|
||||
"laravelista/lumen-vendor-publish": "Needed to publish the package configuration in Lumen"
|
||||
},
|
||||
"type": "package",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "v13-dev"
|
||||
},
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"OwenIt\\Auditing\\AuditingServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"OwenIt\\Auditing\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Antério Vieira",
|
||||
"email": "anteriovieira@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Raphael França",
|
||||
"email": "raphaelfrancabsb@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Morten D. Hansen",
|
||||
"email": "morten@visia.dk"
|
||||
}
|
||||
],
|
||||
"description": "Audit changes of your Eloquent models in Laravel/Lumen",
|
||||
"homepage": "http://laravel-auditing.com",
|
||||
"keywords": [
|
||||
"Accountability",
|
||||
"Audit",
|
||||
"auditing",
|
||||
"changes",
|
||||
"eloquent",
|
||||
"history",
|
||||
"laravel",
|
||||
"log",
|
||||
"logging",
|
||||
"lumen",
|
||||
"observer",
|
||||
"record",
|
||||
"revision",
|
||||
"tracking"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/owen-it/laravel-auditing/issues",
|
||||
"source": "https://github.com/owen-it/laravel-auditing"
|
||||
},
|
||||
"time": "2022-04-20T14:28:57+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpoption/phpoption",
|
||||
"version": "1.8.1",
|
||||
@ -5400,16 +5488,16 @@
|
||||
},
|
||||
{
|
||||
"name": "laravel/sail",
|
||||
"version": "v1.14.2",
|
||||
"version": "v1.14.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/laravel/sail.git",
|
||||
"reference": "cee088fbe57432dd15678e3f7b6a8259f3073c46"
|
||||
"reference": "0e0e51f19c758c79acbda11e3870641fbad5b7d9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/laravel/sail/zipball/cee088fbe57432dd15678e3f7b6a8259f3073c46",
|
||||
"reference": "cee088fbe57432dd15678e3f7b6a8259f3073c46",
|
||||
"url": "https://api.github.com/repos/laravel/sail/zipball/0e0e51f19c758c79acbda11e3870641fbad5b7d9",
|
||||
"reference": "0e0e51f19c758c79acbda11e3870641fbad5b7d9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -5456,7 +5544,7 @@
|
||||
"issues": "https://github.com/laravel/sail/issues",
|
||||
"source": "https://github.com/laravel/sail"
|
||||
},
|
||||
"time": "2022-05-10T12:58:49+00:00"
|
||||
"time": "2022-05-12T12:53:10+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mockery/mockery",
|
||||
@ -7463,16 +7551,16 @@
|
||||
},
|
||||
{
|
||||
"name": "spatie/flare-client-php",
|
||||
"version": "1.1.0",
|
||||
"version": "1.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/spatie/flare-client-php.git",
|
||||
"reference": "ceab058852a1278d9f57a7b95f1c348e4956d866"
|
||||
"reference": "1059fd8f229fa016b11063c6be9d1922d036adb7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/spatie/flare-client-php/zipball/ceab058852a1278d9f57a7b95f1c348e4956d866",
|
||||
"reference": "ceab058852a1278d9f57a7b95f1c348e4956d866",
|
||||
"url": "https://api.github.com/repos/spatie/flare-client-php/zipball/1059fd8f229fa016b11063c6be9d1922d036adb7",
|
||||
"reference": "1059fd8f229fa016b11063c6be9d1922d036adb7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -7493,6 +7581,11 @@
|
||||
"spatie/phpunit-snapshot-assertions": "^4.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.1.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/helpers.php"
|
||||
@ -7515,7 +7608,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/spatie/flare-client-php/issues",
|
||||
"source": "https://github.com/spatie/flare-client-php/tree/1.1.0"
|
||||
"source": "https://github.com/spatie/flare-client-php/tree/1.1.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -7523,20 +7616,20 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2022-03-11T13:21:28+00:00"
|
||||
"time": "2022-05-11T09:43:07+00:00"
|
||||
},
|
||||
{
|
||||
"name": "spatie/ignition",
|
||||
"version": "1.2.10",
|
||||
"version": "1.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/spatie/ignition.git",
|
||||
"reference": "dd8c3a21170b1d0f4d15048b2f4fa4a1a3a92a64"
|
||||
"reference": "6aa8f1c8c46aff30c9bd4c354dc865eeee2ed59f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/spatie/ignition/zipball/dd8c3a21170b1d0f4d15048b2f4fa4a1a3a92a64",
|
||||
"reference": "dd8c3a21170b1d0f4d15048b2f4fa4a1a3a92a64",
|
||||
"url": "https://api.github.com/repos/spatie/ignition/zipball/6aa8f1c8c46aff30c9bd4c354dc865eeee2ed59f",
|
||||
"reference": "6aa8f1c8c46aff30c9bd4c354dc865eeee2ed59f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -7557,6 +7650,11 @@
|
||||
"symfony/process": "^5.4|^6.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "1.2.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Spatie\\Ignition\\": "src"
|
||||
@ -7593,7 +7691,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2022-05-10T12:21:27+00:00"
|
||||
"time": "2022-05-12T08:19:04+00:00"
|
||||
},
|
||||
{
|
||||
"name": "spatie/laravel-ignition",
|
||||
|
||||
@ -56,6 +56,8 @@ return [
|
||||
|
||||
'url' => env('APP_URL', 'http://localhost'),
|
||||
|
||||
'frontend_url' => env('FRONTEND_URL', 'http://localhost:3000'),
|
||||
|
||||
'asset_url' => env('ASSET_URL'),
|
||||
|
||||
/*
|
||||
@ -195,6 +197,11 @@ return [
|
||||
App\Providers\EventServiceProvider::class,
|
||||
App\Providers\RouteServiceProvider::class,
|
||||
|
||||
/*
|
||||
* Laravel Auditing
|
||||
*/
|
||||
OwenIt\Auditing\AuditingServiceProvider::class,
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|
||||
23
database/factories/DadosCadastraisFactory.php
Normal file
23
database/factories/DadosCadastraisFactory.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\DadosCadastrais>
|
||||
*/
|
||||
class DadosCadastraisFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
23
database/factories/DadosTeFactory.php
Normal file
23
database/factories/DadosTeFactory.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\DadosTe>
|
||||
*/
|
||||
class DadosTeFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
23
database/factories/EconomyFactory.php
Normal file
23
database/factories/EconomyFactory.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\economy>
|
||||
*/
|
||||
class EconomyFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
23
database/factories/FaqFactory.php
Normal file
23
database/factories/FaqFactory.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Faq>
|
||||
*/
|
||||
class FaqFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
23
database/factories/Med5minFactory.php
Normal file
23
database/factories/Med5minFactory.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Med5min>
|
||||
*/
|
||||
class Med5minFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
23
database/factories/NewsFactory.php
Normal file
23
database/factories/NewsFactory.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\News>
|
||||
*/
|
||||
class NewsFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
23
database/factories/NotificationsFactory.php
Normal file
23
database/factories/NotificationsFactory.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Notifications>
|
||||
*/
|
||||
class NotificationsFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
23
database/factories/ParametersFactory.php
Normal file
23
database/factories/ParametersFactory.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Parameters>
|
||||
*/
|
||||
class ParametersFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
23
database/factories/PermissionFactory.php
Normal file
23
database/factories/PermissionFactory.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Permission>
|
||||
*/
|
||||
class PermissionFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
23
database/factories/PldFactory.php
Normal file
23
database/factories/PldFactory.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Pld>
|
||||
*/
|
||||
class PldFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
23
database/factories/RoleFactory.php
Normal file
23
database/factories/RoleFactory.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Role>
|
||||
*/
|
||||
class RoleFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition()
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -21,6 +21,7 @@ return new class extends Migration
|
||||
$table->string('password');
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -21,6 +21,7 @@ return new class extends Migration
|
||||
$table->text('abilities')->nullable();
|
||||
$table->timestamp('last_used_at')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
34
database/migrations/2022_05_12_021354_create_news_table.php
Normal file
34
database/migrations/2022_05_12_021354_create_news_table.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('news', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('title', 255);
|
||||
$table->text('text');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('news');
|
||||
}
|
||||
};
|
||||
32
database/migrations/2022_05_12_022040_create_faqs_table.php
Normal file
32
database/migrations/2022_05_12_022040_create_faqs_table.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('faqs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('faqs');
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateAuditsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('audits', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('user_type')->nullable();
|
||||
$table->unsignedBigInteger('user_id')->nullable();
|
||||
$table->string('event');
|
||||
$table->morphs('auditable');
|
||||
$table->text('old_values')->nullable();
|
||||
$table->text('new_values')->nullable();
|
||||
$table->text('url')->nullable();
|
||||
$table->ipAddress('ip_address')->nullable();
|
||||
$table->string('user_agent', 1023)->nullable();
|
||||
$table->string('tags')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->index(['user_id', 'user_type']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('audits');
|
||||
}
|
||||
}
|
||||
33
database/migrations/2022_05_12_025316_create_roles_table.php
Normal file
33
database/migrations/2022_05_12_025316_create_roles_table.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('roles', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('roles');
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('dados_cadastrais', function (Blueprint $table) {
|
||||
$table->bigIncrements('cod_smart_unidade');
|
||||
$table->text('cliente');
|
||||
$table->text('unidade');
|
||||
$table->text('codigo_scde');
|
||||
$table->decimal('demanda_p');
|
||||
$table->decimal('demanda_fp');
|
||||
$table->text('status_empresa');
|
||||
$table->text('status_unidade');
|
||||
$table->decimal('data_de_migracao');
|
||||
$table->bigInteger('cod_smart_cliente');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('dados_cadastrais');
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('economia', function (Blueprint $table) {
|
||||
$table->bigIncrements('cod_econ');
|
||||
$table->bigInteger('cod_smart_unidade');
|
||||
$table->text('mes text');
|
||||
$table->decimal('custo_cativo');
|
||||
$table->decimal('custo_livre');
|
||||
$table->decimal('economia_mensal');
|
||||
$table->decimal('economia_acumulada');
|
||||
$table->decimal('custo_unit');
|
||||
$table->boolean('dad_estimado');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->foreign('cod_smart_unidade', 'economia_cod_smart_unidade_fkey')
|
||||
->references('cod_smart_unidade')->on('dados_cadastrais');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('economia');
|
||||
}
|
||||
};
|
||||
38
database/migrations/2022_05_12_174204_create_pld_table.php
Normal file
38
database/migrations/2022_05_12_174204_create_pld_table.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('pld', function (Blueprint $table) {
|
||||
$table->integerIncrements('id');
|
||||
$table->decimal('dia_num')->nullable();
|
||||
$table->decimal('hora')->nullable();
|
||||
$table->text('submercado')->nullable();
|
||||
$table->decimal('valor')->nullable();
|
||||
$table->string('mes_ref')->nullable();
|
||||
$table->decimal('dia_da_semana')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('pld');
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('med_5min', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->text('origem');
|
||||
$table->decimal('dia_num');
|
||||
$table->integer('minuto');
|
||||
$table->decimal('ativa_consumo');
|
||||
$table->decimal('ativa_geracao');
|
||||
$table->decimal('reativa_consumo');
|
||||
$table->decimal('reativa_geracao');
|
||||
$table->text('ponto');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('med_5min');
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('dados_te', function (Blueprint $table) {
|
||||
$table->bigIncrements('cod_te');
|
||||
$table->bigInteger('cod_smart_unidade')->nullable();
|
||||
$table->text('mes')->nullable();;
|
||||
$table->text('operacao')->nullable();
|
||||
$table->text('tipo')->nullable();
|
||||
$table->decimal('montante_nf')->nullable();
|
||||
$table->decimal('preco_nf')->nullable();
|
||||
$table->decimal('nf_c_icms')->nullable();
|
||||
$table->text('perfil_contr')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->foreign('cod_smart_unidade', 'dados_te_cod_smart_unidade_fkey')
|
||||
->references('cod_smart_unidade')->on('dados_cadastrais')->onDelete('no action')->onUpdate('no action');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('dados_te');
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('permissions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('permissions');
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('role_user', function (Blueprint $table) {
|
||||
$table->unsignedInteger('user_id');
|
||||
$table->foreign('user_id', 'user_id_fk_2220802')->references('id')->on('users')->onDelete('cascade');
|
||||
$table->unsignedInteger('role_id');
|
||||
$table->foreign('role_id', 'role_id_fk_2220802')->references('id')->on('roles')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('role_user');
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('permission_role', function (Blueprint $table) {
|
||||
$table->unsignedInteger('role_id');
|
||||
$table->foreign('role_id', 'role_id_fk_2220793')->references('id')->on('roles')->onDelete('cascade');
|
||||
$table->unsignedInteger('permission_id');
|
||||
$table->foreign('permission_id', 'permission_id_fk_2220793')->references('id')->on('permissions')->onDelete('cascade');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('permission_role');
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('notificacoes', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('cliente_id');
|
||||
$table->text('texto');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('notificacoes');
|
||||
}
|
||||
};
|
||||
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('parametros', function (Blueprint $table) {
|
||||
$table->integerIncrements('codigo');
|
||||
$table->string('argumento');
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('parametros');
|
||||
}
|
||||
};
|
||||
19
database/seeders/DadosCadastraisSeeder.php
Normal file
19
database/seeders/DadosCadastraisSeeder.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DadosCadastraisSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
19
database/seeders/DadosTeSeeder.php
Normal file
19
database/seeders/DadosTeSeeder.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DadosTeSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@ -12,13 +12,12 @@ class DatabaseSeeder extends Seeder
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
public function run(): void
|
||||
{
|
||||
// \App\Models\User::factory(10)->create();
|
||||
|
||||
// \App\Models\User::factory()->create([
|
||||
// 'name' => 'Test User',
|
||||
// 'email' => 'test@example.com',
|
||||
// ]);
|
||||
$this->call([
|
||||
UserTableSeeder::class,
|
||||
RoleTableSeeder::class,
|
||||
RoleUserTableSeeder::class
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
19
database/seeders/EconomySeeder.php
Normal file
19
database/seeders/EconomySeeder.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class EconomySeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
19
database/seeders/FaqSeeder.php
Normal file
19
database/seeders/FaqSeeder.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class FaqSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
19
database/seeders/Med5minSeeder.php
Normal file
19
database/seeders/Med5minSeeder.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class Med5minSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
19
database/seeders/NewsSeeder.php
Normal file
19
database/seeders/NewsSeeder.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class NewsSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
19
database/seeders/NotificationsSeeder.php
Normal file
19
database/seeders/NotificationsSeeder.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class NotificationsSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
19
database/seeders/ParametersSeeder.php
Normal file
19
database/seeders/ParametersSeeder.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ParametersSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
19
database/seeders/PermissionSeeder.php
Normal file
19
database/seeders/PermissionSeeder.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class PermissionSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
19
database/seeders/PldSeeder.php
Normal file
19
database/seeders/PldSeeder.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class PldSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
27
database/seeders/RoleTableSeeder.php
Normal file
27
database/seeders/RoleTableSeeder.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Role;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Routing\Route;
|
||||
|
||||
class RoleTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Role::query()->create([
|
||||
'name' => 'Admin'
|
||||
]);
|
||||
|
||||
Role::query()->create([
|
||||
'name' => 'Client'
|
||||
]);
|
||||
}
|
||||
}
|
||||
14
database/seeders/RoleUserTableSeeder.php
Normal file
14
database/seeders/RoleUserTableSeeder.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class RoleUserTableSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
User::findOrFail(1)->roles()->sync(1);
|
||||
}
|
||||
}
|
||||
32
database/seeders/UserTableSeeder.php
Normal file
32
database/seeders/UserTableSeeder.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class UserTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
User::query()->create([
|
||||
'name' => 'Admin',
|
||||
'email' => 'admin@admin.com',
|
||||
'password' => bcrypt('password'),
|
||||
'remember_token' => null,
|
||||
]);
|
||||
|
||||
User::query()->create([
|
||||
'name' => 'Client',
|
||||
'email' => 'client@client.com',
|
||||
'password' => bcrypt('password'),
|
||||
'remember_token' => null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
50
docker-compose.yml
Normal file
50
docker-compose.yml
Normal file
@ -0,0 +1,50 @@
|
||||
# For more information: https://laravel.com/docs/sail
|
||||
version: '3'
|
||||
services:
|
||||
laravel.test:
|
||||
build:
|
||||
context: ./docker/8.1
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
WWWGROUP: '${WWWGROUP}'
|
||||
image: sail-8.1/app
|
||||
extra_hosts:
|
||||
- 'host.docker.internal:host-gateway'
|
||||
ports:
|
||||
- '${APP_PORT:-80}:80'
|
||||
- '${HMR_PORT:-8080}:8080'
|
||||
environment:
|
||||
WWWUSER: '${WWWUSER}'
|
||||
LARAVEL_SAIL: 1
|
||||
XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}'
|
||||
XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}'
|
||||
volumes:
|
||||
- '.:/var/www/html'
|
||||
networks:
|
||||
- sail
|
||||
depends_on:
|
||||
- pgsql
|
||||
pgsql:
|
||||
image: 'postgres:14'
|
||||
ports:
|
||||
- '${FORWARD_DB_PORT:-5432}:5432'
|
||||
environment:
|
||||
PGPASSWORD: '${DB_PASSWORD:-secret}'
|
||||
POSTGRES_DB: '${DB_DATABASE}'
|
||||
POSTGRES_USER: '${DB_USERNAME}'
|
||||
POSTGRES_PASSWORD: '${DB_PASSWORD:-secret}'
|
||||
volumes:
|
||||
- 'sail-pgsql:/var/lib/postgresql/data'
|
||||
- './vendor/laravel/sail/database/pgsql/create-testing-database.sql:/docker-entrypoint-initdb.d/10-create-testing-database.sql'
|
||||
networks:
|
||||
- sail
|
||||
healthcheck:
|
||||
test: ["CMD", "pg_isready", "-q", "-d", "${DB_DATABASE}", "-U", "${DB_USERNAME}"]
|
||||
retries: 3
|
||||
timeout: 5s
|
||||
networks:
|
||||
sail:
|
||||
driver: bridge
|
||||
volumes:
|
||||
sail-pgsql:
|
||||
driver: local
|
||||
61
docker/8.1/Dockerfile
Normal file
61
docker/8.1/Dockerfile
Normal file
@ -0,0 +1,61 @@
|
||||
FROM ubuntu:22.04
|
||||
|
||||
LABEL maintainer="Taylor Otwell"
|
||||
|
||||
ARG WWWGROUP
|
||||
ARG NODE_VERSION=16
|
||||
ARG POSTGRES_VERSION=14
|
||||
|
||||
WORKDIR /var/www/html
|
||||
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
ENV TZ=UTC
|
||||
|
||||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 \
|
||||
&& mkdir -p ~/.gnupg \
|
||||
&& chmod 600 ~/.gnupg \
|
||||
&& echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf \
|
||||
&& apt-key adv --homedir ~/.gnupg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 0x14AA40EC0831756756D7F66C4F4EA0AAE5267A6C \
|
||||
&& echo "deb https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y php8.1-cli php8.1-dev \
|
||||
php8.1-pgsql php8.1-sqlite3 php8.1-gd \
|
||||
php8.1-curl \
|
||||
php8.1-imap php8.1-mysql php8.1-mbstring \
|
||||
php8.1-xml php8.1-zip php8.1-bcmath php8.1-soap \
|
||||
php8.1-intl php8.1-readline \
|
||||
php8.1-ldap \
|
||||
php8.1-msgpack php8.1-igbinary php8.1-redis php8.1-swoole \
|
||||
php8.1-memcached php8.1-pcov php8.1-xdebug \
|
||||
&& php -r "readfile('https://getcomposer.org/installer');" | php -- --install-dir=/usr/bin/ --filename=composer \
|
||||
&& curl -sL https://deb.nodesource.com/setup_$NODE_VERSION.x | bash - \
|
||||
&& apt-get install -y nodejs \
|
||||
&& npm install -g npm \
|
||||
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
|
||||
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list \
|
||||
&& echo "deb http://apt.postgresql.org/pub/repos/apt jammy-pgdg main" > /etc/apt/sources.list.d/pgdg.list \
|
||||
&& curl --silent -o - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y yarn \
|
||||
&& apt-get install -y mysql-client \
|
||||
&& apt-get install -y postgresql-client-$POSTGRES_VERSION \
|
||||
&& apt-get -y autoremove \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
RUN setcap "cap_net_bind_service=+ep" /usr/bin/php8.1
|
||||
|
||||
RUN groupadd --force -g $WWWGROUP sail
|
||||
RUN useradd -ms /bin/bash --no-user-group -g $WWWGROUP -u 1337 sail
|
||||
|
||||
COPY start-container /usr/local/bin/start-container
|
||||
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
COPY php.ini /etc/php/8.1/cli/conf.d/99-sail.ini
|
||||
RUN chmod +x /usr/local/bin/start-container
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
ENTRYPOINT ["start-container"]
|
||||
4
docker/8.1/php.ini
Normal file
4
docker/8.1/php.ini
Normal file
@ -0,0 +1,4 @@
|
||||
[PHP]
|
||||
post_max_size = 100M
|
||||
upload_max_filesize = 100M
|
||||
variables_order = EGPCS
|
||||
17
docker/8.1/start-container
Normal file
17
docker/8.1/start-container
Normal file
@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ ! -z "$WWWUSER" ]; then
|
||||
usermod -u $WWWUSER sail
|
||||
fi
|
||||
|
||||
if [ ! -d /.composer ]; then
|
||||
mkdir /.composer
|
||||
fi
|
||||
|
||||
chmod -R ugo+rw /.composer
|
||||
|
||||
if [ $# -gt 0 ]; then
|
||||
exec gosu $WWWUSER "$@"
|
||||
else
|
||||
/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf
|
||||
fi
|
||||
14
docker/8.1/supervisord.conf
Normal file
14
docker/8.1/supervisord.conf
Normal file
@ -0,0 +1,14 @@
|
||||
[supervisord]
|
||||
nodaemon=true
|
||||
user=root
|
||||
logfile=/var/log/supervisor/supervisord.log
|
||||
pidfile=/var/run/supervisord.pid
|
||||
|
||||
[program:php]
|
||||
command=/usr/bin/php -d variables_order=EGPCS /var/www/html/artisan serve --host=0.0.0.0 --port=80
|
||||
user=sail
|
||||
environment=LARAVEL_SAIL="1"
|
||||
stdout_logfile=/dev/stdout
|
||||
stdout_logfile_maxbytes=0
|
||||
stderr_logfile=/dev/stderr
|
||||
stderr_logfile_maxbytes=0
|
||||
@ -21,8 +21,7 @@
|
||||
<env name="APP_ENV" value="testing"/>
|
||||
<env name="BCRYPT_ROUNDS" value="4"/>
|
||||
<env name="CACHE_DRIVER" value="array"/>
|
||||
<!-- <env name="DB_CONNECTION" value="sqlite"/> -->
|
||||
<!-- <env name="DB_DATABASE" value=":memory:"/> -->
|
||||
<env name="DB_DATABASE" value="testing"/>
|
||||
<env name="MAIL_MAILER" value="array"/>
|
||||
<env name="QUEUE_CONNECTION" value="sync"/>
|
||||
<env name="SESSION_DRIVER" value="array"/>
|
||||
|
||||
@ -14,6 +14,15 @@ use Illuminate\Support\Facades\Route;
|
||||
|
|
||||
*/
|
||||
|
||||
Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
|
||||
return $request->user();
|
||||
Route::prefix('auth')->group(function (){
|
||||
Route::post('login', [\App\Http\Controllers\Auth\AuthController::class, 'login']);
|
||||
Route::post('logout', [\App\Http\Controllers\Auth\AuthController::class, 'logout']);
|
||||
Route::post('register', [\App\Http\Controllers\Auth\RegisterController::class, 'store']);
|
||||
});
|
||||
|
||||
Route::middleware(['auth:sanctum', 'verified'])->group(function () {
|
||||
Route::get('teste', [\App\Http\Controllers\EconomyController::class, 'index']);
|
||||
Route::apiResource('user', \App\Http\Controllers\UserController::class);
|
||||
});
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user