Compare commits

...

27 Commits

Author SHA1 Message Date
51030b85df Refactor code structure for improved readability and maintainability 2025-10-31 09:56:58 -03:00
Ubuntu
1b841757da Merge branch 'master' of https://gitlab.com/kluppsoftware/smart-energia-api 2024-01-29 19:23:10 +00:00
marcio1002
206140111d Correção ao criar usuários importado do excel 2024-01-29 16:22:20 -03:00
marcio1002
45befa9bb8 Correção nas rotas para tipo admin 2024-01-29 16:13:04 -03:00
root
a2305f5291 Merge branch 'master' of https://gitlab.com/kluppsoftware/smart-energia-api 2024-01-29 18:39:27 +00:00
marcio1002
8a4f4daaa5 Modificações com padronização de retorno nas rotas e algumas correções 2024-01-29 15:12:22 -03:00
marcio1002
0b58e2923b Ajustes 2023-12-18 20:15:16 -03:00
marcio1002
71a9d2aab7 Ajustes e adicição do script para recuprar a senha dos usuários 2023-12-15 12:27:55 -03:00
Ubuntu
0ec70c9ae6 Merge branch 'master' of https://gitlab.com/kluppsoftware/smart-energia-api 2023-12-13 22:02:40 +00:00
marcio1002
00c0181dce Correção no endpoint notify 2023-12-13 19:01:27 -03:00
Ubuntu
ce54f362d7 Merge branch 'master' of https://gitlab.com/kluppsoftware/smart-energia-api 2023-12-13 21:46:39 +00:00
Ubuntu
c439b92326 Merge branch 'master' of https://gitlab.com/kluppsoftware/smart-energia-api 2023-12-13 13:09:36 +00:00
Ubuntu
58915331f7 Merge branch 'master' of https://gitlab.com/kluppsoftware/smart-energia-api 2023-10-26 21:41:01 +00:00
Ubuntu
70dc2938da Merge branch 'master' of https://gitlab.com/kluppsoftware/smart-energia-api 2023-10-26 21:13:40 +00:00
Ubuntu
795fc168c9 Merge branch 'master' of https://gitlab.com/kluppsoftware/smart-energia-api 2023-10-25 20:27:56 +00:00
Ubuntu
c977f873d5 Merge branch 'master' of https://gitlab.com/kluppsoftware/smart-energia-api 2023-10-25 20:02:37 +00:00
Ubuntu
7d604b1322 Merge branch 'master' of https://gitlab.com/kluppsoftware/smart-energia-api 2023-10-25 16:39:38 +00:00
Ubuntu
d211ce9d50 Merge branch 'master' of https://gitlab.com/kluppsoftware/smart-energia-api 2023-10-23 15:39:06 +00:00
Ubuntu
a151758bbc Merge branch 'master' of https://gitlab.com/kluppsoftware/smart-energia-api 2023-10-23 15:20:46 +00:00
Ubuntu
722865b622 Merge branch 'master' of https://gitlab.com/kluppsoftware/smart-energia-api 2023-10-20 22:23:44 +00:00
root
eac8456806 Merge branch 'master' of https://gitlab.com/kluppsoftware/smart-energia-api 2023-10-20 22:11:19 +00:00
root
0512cda54b Merge branch 'master' of https://gitlab.com/kluppsoftware/smart-energia-api 2023-10-20 21:31:23 +00:00
Ubuntu
73c25da173 Merge branch 'master' of https://gitlab.com/kluppsoftware/smart-energia-api 2023-10-20 19:14:05 +00:00
Ubuntu
1ca66fc72d Merge branch 'master' of https://gitlab.com/kluppsoftware/smart-energia-api 2023-07-26 16:42:38 +00:00
Ubuntu
7e8075a2e0 Merge branch 'master' of https://gitlab.com/kluppsoftware/smart-energia-api 2023-04-27 21:14:14 +00:00
Ubuntu
3790cc54d5 Merge branch 'master' of https://gitlab.com/kluppsoftware/smart-energia-api 2023-04-27 20:57:07 +00:00
Ubuntu
3d28735e10 Local admin file updates 2023-04-27 20:56:29 +00:00
303 changed files with 2399 additions and 1443 deletions

View File

@ -3,6 +3,7 @@ APP_ENV=local
APP_KEY= APP_KEY=
APP_DEBUG=true APP_DEBUG=true
APP_URL=http://localhost APP_URL=http://localhost
FRONTEND_URL=http://localhost:3444
LOG_CHANNEL=stack LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null LOG_DEPRECATIONS_CHANNEL=null
@ -50,3 +51,5 @@ PUSHER_APP_CLUSTER=mt1
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
WEBHOOK_NEWS=""

1
.gitignore vendored
View File

@ -4,6 +4,7 @@
/storage/*.key /storage/*.key
/vendor /vendor
.env .env
.env.local
.env.backup .env.backup
.phpunit.result.cache .phpunit.result.cache
Homestead.json Homestead.json

View File

@ -1,64 +1,3 @@
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400"></a></p> # API
<p align="center"> ## Requerimentos
<a href="https://travis-ci.org/laravel/framework"><img src="https://travis-ci.org/laravel/framework.svg" alt="Build Status"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/dt/laravel/framework" alt="Total Downloads"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/v/laravel/framework" alt="Latest Stable Version"></a>
<a href="https://packagist.org/packages/laravel/framework"><img src="https://img.shields.io/packagist/l/laravel/framework" alt="License"></a>
</p>
## About Laravel
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
- [Simple, fast routing engine](https://laravel.com/docs/routing).
- [Powerful dependency injection container](https://laravel.com/docs/container).
- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage.
- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent).
- Database agnostic [schema migrations](https://laravel.com/docs/migrations).
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
Laravel is accessible, powerful, and provides tools required for large, robust applications.
## Learning Laravel
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
If you don't feel like reading, [Laracasts](https://laracasts.com) can help. Laracasts contains over 2000 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
## Laravel Sponsors
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell).
### Premium Partners
- **[Vehikl](https://vehikl.com/)**
- **[Tighten Co.](https://tighten.co)**
- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)**
- **[64 Robots](https://64robots.com)**
- **[Cubet Techno Labs](https://cubettech.com)**
- **[Cyber-Duck](https://cyber-duck.co.uk)**
- **[Many](https://www.many.co.uk)**
- **[Webdock, Fast VPS Hosting](https://www.webdock.io/en)**
- **[DevSquad](https://devsquad.com)**
- **[Curotec](https://www.curotec.com/services/technologies/laravel/)**
- **[OP.GG](https://op.gg)**
- **[WebReinvent](https://webreinvent.com/?utm_source=laravel&utm_medium=github&utm_campaign=patreon-sponsors)**
- **[Lendio](https://lendio.com)**
## Contributing
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions).
## Code of Conduct
In order to ensure that the Laravel community is welcoming to all, please review and abide by the [Code of Conduct](https://laravel.com/docs/contributions#code-of-conduct).
## Security Vulnerabilities
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
## License
The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

View File

@ -16,6 +16,7 @@ class Kernel extends ConsoleKernel
protected function schedule(Schedule $schedule) protected function schedule(Schedule $schedule)
{ {
// $schedule->command('inspire')->hourly(); // $schedule->command('inspire')->hourly();
$schedule->command('telescope:prune')->cron('0 0 */21 * *');
} }
/** /**

View File

@ -2,7 +2,7 @@
namespace App\Exceptions; namespace App\Exceptions;
use App\Helpers\ResponseJson; use App\Helpers\ResponseJsonMessage;
use Illuminate\Http\Response; use Illuminate\Http\Response;
use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\App;
use Illuminate\Database\QueryException; use Illuminate\Database\QueryException;
@ -51,13 +51,12 @@ class Handler extends ExceptionHandler
private function messageCustom(\Throwable $ex): array private function messageCustom(\Throwable $ex): array
{ {
$messageCustom = []; $messageCustom = [];
$class_exceptions = [ $class_exceptions = [
AuthorizationException::class => fn ($e) => [ AuthorizationException::class => fn ($e) => [
'Unauthorized', 'Forbidden',
Response::HTTP_UNAUTHORIZED Response::HTTP_FORBIDDEN
], ],
AuthenticationException::class => fn ($e) => [ AuthenticationException::class => fn ($e) => [
@ -115,7 +114,6 @@ class Handler extends ExceptionHandler
]; ];
} }
return $messageCustom; return $messageCustom;
} }
@ -135,7 +133,7 @@ class Handler extends ExceptionHandler
Log::error($message); Log::error($message);
return false; return false; //https://laravel.com/docs/9.x/errors#reporting-exceptions
}); });
} }
@ -150,6 +148,6 @@ class Handler extends ExceptionHandler
{ {
[$message, $status_code] = $this->messageCustom($ex); [$message, $status_code] = $this->messageCustom($ex);
return ResponseJson::error($message, $status_code); return ResponseJsonMessage::withError($message, $status_code);
} }
} }

View File

@ -5,20 +5,20 @@ namespace App\Helpers;
use Illuminate\Http\Response; use Illuminate\Http\Response;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
class ResponseJson class ResponseJsonMessage
{ {
public static function message(string $message, $status_code = Response::HTTP_OK): JsonResponse public static function withMessage(string $message, $status_code = Response::HTTP_OK): JsonResponse
{ {
return response()->json(compact('message'), $status_code); return response()->json(compact('message'), $status_code);
} }
public static function data(mixed $data, $status_code = Response::HTTP_OK): JsonResponse public static function withData(mixed $data, $status_code = Response::HTTP_OK): JsonResponse
{ {
return response()->json(compact('data'), $status_code); return response()->json(compact('data'), $status_code);
} }
public static function error(mixed $error, int $status_code): JsonResponse public static function withError(mixed $error, int $status_code): JsonResponse
{ {
return response()->json(compact('error'), $status_code); return response()->json(compact('error'), $status_code);
} }

View File

@ -4,51 +4,38 @@ declare(strict_types=1);
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Helpers\ResponseJsonMessage;
use App\Http\Requests\StoreAboutUsRequest; use App\Http\Requests\StoreAboutUsRequest;
use App\Http\Resources\AboutUsResource;
use App\Repositories\AboutUs\AboutUsContractInterface; use App\Repositories\AboutUs\AboutUsContractInterface;
use App\Traits\ApiResponse;
use Illuminate\Http\Response;
class AboutUsController extends Controller class AboutUsController extends Controller
{ {
use ApiResponse;
public function __construct( public function __construct(
protected AboutUsContractInterface $aboutUsContract protected AboutUsContractInterface $aboutUsContract
){} ) {
}
public function index() public function index()
{ {
try { $response = $this->aboutUsContract->all();
$response = $this->aboutUsContract->all();
return (new AboutUsResource($response)) return ResponseJsonMessage::withData($response);
->response()
->setStatusCode(Response::HTTP_OK);
} catch (\Exception $ex) {
return $this->errorResponse(false, $ex->getMessage(), Response::HTTP_INTERNAL_SERVER_ERROR);
}
} }
public function store(StoreAboutUsRequest $aboutUsRequest) public function store(StoreAboutUsRequest $aboutUsRequest)
{ {
try {
$about = $this->aboutUsContract->max('id'); $about = $this->aboutUsContract->max('id');
if ($about !== null) if ($about !== null) {
{ $response = $this->aboutUsContract->update($aboutUsRequest->validated(), $about);
$response = $this->aboutUsContract->update($aboutUsRequest->validated(), $about); } else {
} else { $response = $this->aboutUsContract->create($aboutUsRequest->validated());
$response = $this->aboutUsContract->create($aboutUsRequest->validated());
}
return (new AboutUsResource($response))
->response()
->setStatusCode(Response::HTTP_ACCEPTED);
} catch (\Exception $ex) {
return $this->errorResponse(false, $ex->getMessage(), Response::HTTP_INTERNAL_SERVER_ERROR);
} }
}
return ResponseJsonMessage::withData($response);
}
} }

View File

@ -3,7 +3,7 @@
namespace App\Http\Controllers\Auth; namespace App\Http\Controllers\Auth;
use App\Models\User; use App\Models\User;
use App\Helpers\ResponseJson; use App\Helpers\ResponseJsonMessage;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Requests\LoginResquest; use App\Http\Requests\LoginResquest;
@ -43,6 +43,6 @@ class AuthController extends Controller
$user?->currentAccessToken()?->delete(); $user?->currentAccessToken()?->delete();
return ResponseJson::message('Token Revoked.'); return ResponseJsonMessage::withMessage('Token Revoked.');
} }
} }

View File

@ -2,57 +2,52 @@
namespace App\Http\Controllers\Auth; namespace App\Http\Controllers\Auth;
use App\Helpers\ResponseJsonMessage;
use App\Http\Requests\ForgotPasswordRequest; use App\Http\Requests\ForgotPasswordRequest;
use App\Mail\ResetPassword; use App\Mail\ResetPassword;
use App\Models\User; use App\Models\User;
use App\Traits\ApiResponse;
use Carbon\Carbon; use Carbon\Carbon;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
class ForgotPasswordController extends Controller class ForgotPasswordController extends Controller
{ {
use ApiResponse;
public function __invoke(ForgotPasswordRequest $request) public function __invoke(ForgotPasswordRequest $request)
{ {
$verify = User::where('email', $request->all()['email'])->exists(); $email = $request->validated('email');
if ($verify) { $is_email = User::where('email', $email)->exists();
$verify2 = DB::table('password_resets')->where([ if (!$is_email) return ResponseJsonMessage::withError(
['email', $request->all()['email']] 'Esse e-mail não existe no nosso sistema',
]); Response::HTTP_BAD_REQUEST
);
if ($verify2->exists()) { DB::table('password_resets')->where('email', $email)->delete();
$verify2->delete();
}
$token = random_int(100000, 999999); $token = random_int(100000, 999999);
$password_reset = DB::table('password_resets')->insert([
'email' => $request->all()['email'],
'token' => $token,
'created_at' => Carbon::now()
]); DB::table('password_resets')->insert([
'email' => $email,
'token' => $token,
'created_at' => Carbon::now()
]);
if ($password_reset) {
$sendMail = Mail::to($request->all()['email'])->send(new ResetPassword($token));
return $this->successResponse(true, "Please check your email for a 6 digit pin", 200); Mail::to($email)->send(new ResetPassword($token));
}
} else { return ResponseJsonMessage::withMessage("Verifique seu e-mail");
return $this->errorResponse(false, "This email does not exist", 400);
}
} }
public function verifyPin(Request $request) public function verifyPin(Request $request)
{ {
} }
} }

View File

@ -2,17 +2,17 @@
namespace App\Http\Controllers\Auth; namespace App\Http\Controllers\Auth;
use App\Models\User;
use App\Helpers\ResponseJsonMessage;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Http\Requests\ResetPasswordRequest; use App\Http\Requests\ResetPasswordRequest;
use App\Models\User;
use App\Traits\ApiResponse; use Illuminate\Support\Carbon;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
class ResetPasswordController extends Controller class ResetPasswordController extends Controller
{ {
use ApiResponse;
public function __invoke(ResetPasswordRequest $resetPasswordRequest) public function __invoke(ResetPasswordRequest $resetPasswordRequest)
{ {
@ -24,11 +24,12 @@ class ResetPasswordController extends Controller
if ($check->exists()) { if ($check->exists()) {
$difference = Carbon::now()->diffInSeconds($check->first()->created_at); $difference = Carbon::now()->diffInSeconds($check->first()->created_at);
if ($difference > 3600) { if ($difference > 3600) {
return $this->errorResponse(false, "Token Expired", 400); return ResponseJsonMessage::withError("Token Expired", 400);
} }
$delete = DB::table('password_resets')->where([ DB::table('password_resets')->where([
['email', $resetPasswordRequest->email], ['email', $resetPasswordRequest->email],
['token', $resetPasswordRequest->token], ['token', $resetPasswordRequest->token],
])->delete(); ])->delete();
@ -39,11 +40,7 @@ class ResetPasswordController extends Controller
'password' => $resetPasswordRequest->password 'password' => $resetPasswordRequest->password
]); ]);
return $this->successResponse([ ResponseJsonMessage::withData($user);
'user' => $user
],
"You can now reset your password",
200);
} else { } else {
return $this->errorResponse(false, "Invalid token", 401); return $this->errorResponse(false, "Invalid token", 401);

View File

@ -4,16 +4,14 @@ declare(strict_types=1);
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Traits\ApiResponse;
use App\Helpers\ResponseJson; use App\Helpers\ResponseJsonMessage;
use App\Repositories\DadosCadastrais\DadosCadastraisContractInterface; use App\Repositories\DadosCadastrais\DadosCadastraisContractInterface;
use Illuminate\Http\Request; use Illuminate\Http\Request;
class ClientController extends Controller class ClientController extends Controller
{ {
use ApiResponse;
public function __construct( public function __construct(
protected DadosCadastraisContractInterface $dadosCadastraisContract protected DadosCadastraisContractInterface $dadosCadastraisContract
) { ) {
@ -23,6 +21,6 @@ class ClientController extends Controller
{ {
$response = $this->dadosCadastraisContract->search($request->all()); $response = $this->dadosCadastraisContract->search($request->all());
return ResponseJson::data($response); return ResponseJsonMessage::withData($response);
} }
} }

View File

@ -4,16 +4,16 @@ declare(strict_types=1);
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Helpers\ResponseJson; use App\Helpers\ResponseJsonMessage;
use App\Repositories\Economy\EconomyContractInterface; use App\Repositories\Economy\EconomyContractInterface;
use App\Traits\ApiResponse;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
class EconomyController extends Controller class EconomyController extends Controller
{ {
use ApiResponse;
public function __construct( public function __construct(
protected EconomyContractInterface $economyContract protected EconomyContractInterface $economyContract
@ -24,14 +24,14 @@ class EconomyController extends Controller
{ {
$response = $this->economyContract->search($request->all()); $response = $this->economyContract->search($request->all());
return ResponseJson::data($response); return ResponseJsonMessage::withData($response);
} }
public function grossAnnualEconomy(Request $request): JsonResponse public function grossAnnualEconomy(Request $request): JsonResponse
{ {
$response = $this->economyContract->getGrossAnnualEconomy($request->all()); $response = $this->economyContract->getGrossAnnualEconomy($request->all());
return ResponseJson::data($response); return ResponseJsonMessage::withData($response);
} }
public function grossMonthlyEconomy(Request $request): JsonResponse public function grossMonthlyEconomy(Request $request): JsonResponse
@ -39,20 +39,20 @@ class EconomyController extends Controller
$response = $this->economyContract->getGrossMonthlyEconomy($request->all()); $response = $this->economyContract->getGrossMonthlyEconomy($request->all());
return ResponseJson::data($response); return ResponseJsonMessage::withData($response);
} }
public function captiveMonthlyEconomy(Request $request): JsonResponse public function captiveMonthlyEconomy(Request $request): JsonResponse
{ {
$response = $this->economyContract->getCaptiveMonthlyEconomy($request->all()); $response = $this->economyContract->getCaptiveMonthlyEconomy($request->all());
return ResponseJson::data($response); return ResponseJsonMessage::withData($response);
} }
public function costMWhEconomy(Request $request): JsonResponse public function costMWhEconomy(Request $request): JsonResponse
{ {
$response = $this->economyContract->getCostMWhEconomy($request->all()); $response = $this->economyContract->getCostMWhEconomy($request->all());
return ResponseJson::data($response); return ResponseJsonMessage::withData($response);
} }
} }

View File

@ -4,8 +4,8 @@ declare(strict_types=1);
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Traits\ApiResponse;
use App\Helpers\ResponseJson; use App\Helpers\ResponseJsonMessage;
use App\Repositories\Faqs\FaqContractInterface; use App\Repositories\Faqs\FaqContractInterface;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
@ -14,7 +14,7 @@ use Illuminate\Http\Response;
class FaqController extends Controller class FaqController extends Controller
{ {
use ApiResponse;
public function __construct( public function __construct(
protected FaqContractInterface $faq protected FaqContractInterface $faq
@ -25,34 +25,34 @@ class FaqController extends Controller
{ {
$response = $this->faq->all(); $response = $this->faq->all();
return ResponseJson::data($response); return ResponseJsonMessage::withData($response);
} }
public function store(Request $notificationRequest): JsonResponse public function store(Request $notificationRequest): JsonResponse
{ {
$response = $this->faq->create($notificationRequest->all()); $response = $this->faq->create($notificationRequest->all());
return ResponseJson::data($response, Response::HTTP_CREATED); return ResponseJsonMessage::withData($response, Response::HTTP_CREATED);
} }
public function show(int $id): JsonResponse public function show(int $id): JsonResponse
{ {
$response = $this->faq->find($id); $response = $this->faq->find($id);
return ResponseJson::data($response); return ResponseJsonMessage::withData($response);
} }
public function update(Request $request, $id): JsonResponse public function update(Request $request, $id): JsonResponse
{ {
$response = $this->faq->update($request->all(), $id); $response = $this->faq->update($request->all(), $id);
return ResponseJson::data($response); return ResponseJsonMessage::withData($response);
} }
public function destroy($id): JsonResponse public function destroy($id): JsonResponse
{ {
$response = $this->faq->destroy($id); $response = $this->faq->destroy($id);
return ResponseJson::data($response); return ResponseJsonMessage::withData($response);
} }
} }

View File

@ -4,22 +4,23 @@ declare(strict_types=1);
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Helpers\ResponseJsonMessage;
use App\Http\Requests\UploadInfoSectorialRequest; use App\Http\Requests\UploadInfoSectorialRequest;
use App\Models\InfoSectorial; use App\Models\InfoSectorial;
use App\Traits\ApiResponse;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str; use Illuminate\Support\Str;
class InfoSectorialController extends Controller class InfoSectorialController extends Controller
{ {
use ApiResponse;
public function updateFile(UploadInfoSectorialRequest $uploadInfoSectorialRequest) public function updateFile(UploadInfoSectorialRequest $uploadInfoSectorialRequest)
{ {
$data = $uploadInfoSectorialRequest->all(); $data = $uploadInfoSectorialRequest->all();
if (!$uploadInfoSectorialRequest->hasFile('file')) { if (!$uploadInfoSectorialRequest->hasFile('file')) {
return $this->errorResponse( false, '', 500); return $this->errorResponse(false, '', 500);
} }
$file = $uploadInfoSectorialRequest->file('file'); $file = $uploadInfoSectorialRequest->file('file');
@ -27,24 +28,19 @@ class InfoSectorialController extends Controller
$data['name'] = Str::of($file->getClientOriginalName())->explode('.')->offsetGet(0); $data['name'] = Str::of($file->getClientOriginalName())->explode('.')->offsetGet(0);
$data['uid'] = Str::of($file->hashName())->explode('.')->offsetGet(0); $data['uid'] = Str::of($file->hashName())->explode('.')->offsetGet(0);
$extension = $file->getClientOriginalExtension(); $extension = $file->getClientOriginalExtension();
$data['path'] = $file->storeAs('pdf', $data['uid'].".{$extension}", 's3'); $data['path'] = $file->storeAs('pdf', $data['uid'] . ".{$extension}", 's3');
return InfoSectorial::query()->create($data); return InfoSectorial::query()->create($data);
} }
public function download() public function download()
{ {
$created_at = InfoSectorial::query()->max('created_at'); $created_at = InfoSectorial::max('created_at');
$data = InfoSectorial::query()->where('created_at', '=', $created_at)->first(); $data = InfoSectorial::where('created_at', '=', $created_at)->first();
if (!Storage::disk('s3')->exists($data->path)) return ResponseJsonMessage::withData(
{ !empty($data) ? Storage::disk('s3')->url($data->path) : ''
return $this->errorResponse( false, '', 500); );
}
$path['path'] = Storage::disk('s3')->url($data->path);
return response()->json($path, 200);
} }
} }

View File

@ -4,7 +4,7 @@ declare(strict_types=1);
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Helpers\ResponseJson; use App\Helpers\ResponseJsonMessage;
use Illuminate\Support\Arr; use Illuminate\Support\Arr;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
@ -29,6 +29,6 @@ class NewsController extends Controller
) )
); );
return ResponseJson::data($resource); return ResponseJsonMessage::withData($resource);
} }
} }

View File

@ -4,10 +4,10 @@ declare(strict_types=1);
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Helpers\ResponseJson; use App\Helpers\ResponseJsonMessage;
use App\Http\Requests\StoreNotificationRequest; use App\Http\Requests\StoreNotificationRequest;
use App\Repositories\Notifications\NotificationContractInterface; use App\Repositories\Notifications\NotificationContractInterface;
use App\Traits\ApiResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
@ -15,7 +15,7 @@ use Illuminate\Http\Response;
class NotificationController extends Controller class NotificationController extends Controller
{ {
use ApiResponse;
public function __construct( public function __construct(
protected NotificationContractInterface $notification protected NotificationContractInterface $notification
@ -26,7 +26,7 @@ class NotificationController extends Controller
{ {
$response = $this->notification->all(); $response = $this->notification->all();
return ResponseJson::data($response); return ResponseJsonMessage::withData($response);
} }
public function store(StoreNotificationRequest $request): JsonResponse public function store(StoreNotificationRequest $request): JsonResponse
@ -34,34 +34,34 @@ class NotificationController extends Controller
$response = $this->notification->create($request->validated()); $response = $this->notification->create($request->validated());
$response->users()->sync($request->input('users.*.user_id', [])); $response->users()->sync($request->input('users.*.user_id', []));
return ResponseJson::data($response, Response::HTTP_CREATED); return ResponseJsonMessage::withData($response, Response::HTTP_CREATED);
} }
public function show(int $id): JsonResponse public function show(int $id): JsonResponse
{ {
$response = $this->notification->find($id); $response = $this->notification->find($id);
return ResponseJson::data($response); return ResponseJsonMessage::withData($response);
} }
public function update(Request $request, $id): JsonResponse public function update(Request $request, $id): JsonResponse
{ {
$response = $this->notification->update($request->all(), $id); $response = $this->notification->update($request->all(), $id);
return ResponseJson::data($response); return ResponseJsonMessage::withData($response);
} }
public function destroy($id): JsonResponse public function destroy($id): JsonResponse
{ {
$response = $this->notification->destroy($id); $response = $this->notification->destroy($id);
return ResponseJson::data($response); return ResponseJsonMessage::withData($response);
} }
public function notify() public function notify()
{ {
$response = $this->notification->getNotify(); $response = $this->notification->getNotify();
return ResponseJson::data($response); return ResponseJsonMessage::withData($response);
} }
} }

View File

@ -5,15 +5,15 @@ declare(strict_types=1);
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Helpers\Helpers; use App\Helpers\Helpers;
use App\Traits\ApiResponse;
use App\Helpers\ResponseJson; use App\Helpers\ResponseJsonMessage;
use App\Repositories\DadosTe\DadosTeContractInterface; use App\Repositories\DadosTe\DadosTeContractInterface;
use Illuminate\Http\Request; use Illuminate\Http\Request;
class OperationSummaryController extends Controller class OperationSummaryController extends Controller
{ {
use ApiResponse;
public function __construct( public function __construct(
protected DadosTeContractInterface $dadosTeContract protected DadosTeContractInterface $dadosTeContract
@ -25,13 +25,13 @@ class OperationSummaryController extends Controller
$response = $this->dadosTeContract->search($request->all(), true); $response = $this->dadosTeContract->search($request->all(), true);
$response = Helpers::orderByDate($response, 'm/Y'); $response = Helpers::orderByDate($response, 'm/Y');
return ResponseJson::data($response); return ResponseJsonMessage::withData($response);
} }
public function operationSummary(Request $request) public function operationSummary(Request $request)
{ {
$response = $this->dadosTeContract->getOperationSummary($request->all()); $response = $this->dadosTeContract->getOperationSummary($request->all());
return ResponseJson::data($response); return ResponseJsonMessage::withData($response);
} }
} }

View File

@ -5,8 +5,8 @@ declare(strict_types=1);
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Helpers\Helpers; use App\Helpers\Helpers;
use App\Helpers\ResponseJson; use App\Helpers\ResponseJsonMessage;
use App\Traits\ApiResponse;
use App\Repositories\Pld\PldContractInterface; use App\Repositories\Pld\PldContractInterface;
use Illuminate\Http\Request; use Illuminate\Http\Request;
@ -14,7 +14,7 @@ use Illuminate\Http\Request;
class PldController extends Controller class PldController extends Controller
{ {
use ApiResponse;
public function __construct( public function __construct(
protected PldContractInterface $pldContract protected PldContractInterface $pldContract
@ -26,34 +26,34 @@ class PldController extends Controller
$response = $this->pldContract->search($request->all()); $response = $this->pldContract->search($request->all());
$response = Helpers::orderByDate($response, 'm/Y', 'mes_ref'); $response = Helpers::orderByDate($response, 'm/Y', 'mes_ref');
return ResponseJson::data($response); return ResponseJsonMessage::withData($response);
} }
public function overviewByRegion() public function overviewByRegion()
{ {
$response = $this->pldContract->getOverviewByRegion(); $response = $this->pldContract->getOverviewByRegion();
return ResponseJson::data($response); return ResponseJsonMessage::withData($response);
} }
public function listConsumption(Request $request) public function listConsumption(Request $request)
{ {
$response = $this->pldContract->getListConsumption($request->all()); $response = $this->pldContract->getListConsumption($request->all());
return ResponseJson::data($response); return ResponseJsonMessage::withData($response);
} }
public function consumptionByDaily(Request $request) public function consumptionByDaily(Request $request)
{ {
$response = $this->pldContract->getConsumptionByDaily($request->all()); $response = $this->pldContract->getConsumptionByDaily($request->all());
return ResponseJson::data($response); return ResponseJsonMessage::withData($response);
} }
public function consumptionBySchedule(Request $request) public function consumptionBySchedule(Request $request)
{ {
$response = $this->pldContract->getConsumptionBySchedule($request->all()); $response = $this->pldContract->getConsumptionBySchedule($request->all());
return ResponseJson::data($response); return ResponseJsonMessage::withData($response);
} }
} }

View File

@ -4,17 +4,17 @@ declare(strict_types=1);
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Helpers\ResponseJson; use App\Helpers\ResponseJsonMessage;
use App\Http\Resources\TelemetryResource; use App\Http\Resources\TelemetryResource;
use App\Repositories\Med5min\Med5minContractInterface; use App\Repositories\Med5min\Med5minContractInterface;
use App\Traits\ApiResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\Response; use Illuminate\Http\Response;
class TelemetryController extends Controller class TelemetryController extends Controller
{ {
use ApiResponse;
public function __construct( public function __construct(
protected Med5minContractInterface $med5minContract protected Med5minContractInterface $med5minContract
@ -25,20 +25,20 @@ class TelemetryController extends Controller
{ {
$response = $this->med5minContract->search($request->all()); $response = $this->med5minContract->search($request->all());
return ResponseJson::data($response); return ResponseJsonMessage::withData($response);
} }
public function discretization(Request $request) public function discretization(Request $request)
{ {
$response = $this->med5minContract->getDiscretization($request->all(), $request->getPathInfo()); $response = $this->med5minContract->getDiscretization($request->all(), $request->getPathInfo());
return ResponseJson::data($response); return ResponseJsonMessage::withData($response);
} }
public function download(Request $request) public function download(Request $request)
{ {
$response = $this->med5minContract->getDiscretization($request->all(), $request->getPathInfo()); $response = $this->med5minContract->getDiscretization($request->all(), $request->getPathInfo());
return ResponseJson::data($response); return ResponseJsonMessage::withData($response);
} }
} }

View File

@ -4,9 +4,9 @@ declare(strict_types=1);
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Helpers\ResponseJson; use App\Helpers\ResponseJsonMessage;
use App\Http\Requests\ImportUsersWithSmartUsersRequest; use App\Http\Requests\ImportUsersWithSmartUsersRequest;
use App\Traits\ApiResponse;
use App\Http\Requests\StoreUserRequest; use App\Http\Requests\StoreUserRequest;
use App\Imports\UsersWithSmartUsersImport; use App\Imports\UsersWithSmartUsersImport;
use App\Repositories\Users\UserContractInterface; use App\Repositories\Users\UserContractInterface;
@ -20,8 +20,6 @@ use Maatwebsite\Excel\Facades\Excel;
class UserController extends Controller class UserController extends Controller
{ {
use ApiResponse;
public function __construct( public function __construct(
protected UserContractInterface $user protected UserContractInterface $user
) { ) {
@ -36,7 +34,7 @@ class UserController extends Controller
{ {
$response = $this->user->getOrdered(); $response = $this->user->getOrdered();
return ResponseJson::data($response); return ResponseJsonMessage::withData($response);
} }
/** /**
@ -60,7 +58,7 @@ class UserController extends Controller
$response = $this->user->create($data); $response = $this->user->create($data);
$response->roles()->sync($data['role']); $response->roles()->sync($data['role']);
return ResponseJson::data($response, Response::HTTP_CREATED); return ResponseJsonMessage::withData($response, Response::HTTP_CREATED);
} }
/** /**
@ -73,7 +71,7 @@ class UserController extends Controller
{ {
$response = $this->user->find($id); $response = $this->user->find($id);
return ResponseJson::data($response); return ResponseJsonMessage::withData($response);
} }
/** /**
@ -89,7 +87,7 @@ class UserController extends Controller
$data['password'] = $request->password; $data['password'] = $request->password;
$response = $this->user->update($data, $id); $response = $this->user->update($data, $id);
return ResponseJson::data($response); return ResponseJsonMessage::withData($response);
} }
/** /**
@ -100,9 +98,9 @@ class UserController extends Controller
*/ */
public function destroy($id): JsonResponse public function destroy($id): JsonResponse
{ {
$response = $this->user->destroy($id); $this->user->destroy($id);
return response()->json($response, Response::HTTP_NO_CONTENT); return ResponseJsonMessage::withMessage('Usuário deletado!');
} }
public function importUserControll(ImportUsersWithSmartUsersRequest $request): JsonResponse public function importUserControll(ImportUsersWithSmartUsersRequest $request): JsonResponse
@ -126,7 +124,7 @@ class UserController extends Controller
disk: $disk, disk: $disk,
); );
return ResponseJson::message('Dados importados com sucesso!', Response::HTTP_CREATED); return ResponseJsonMessage::withMessage('Dados importados com sucesso!', Response::HTTP_CREATED);
} catch (\Throwable $th) { } catch (\Throwable $th) {
throw $th; throw $th;
} finally { } finally {

View File

@ -72,13 +72,19 @@ class UsersWithSmartUsersImport implements ToCollection
? $this->files_paths[$client_id] ? $this->files_paths[$client_id]
: ''; : '';
User::create(\compact(
/**
* @var ?\App\Models\User $user
*/
$user = User::create(\compact(
'client_id', 'client_id',
'name', 'name',
'email', 'email',
'password', 'password',
'profile_picture' 'profile_picture'
)); ));
$user?->roles()?->sync([2]);
} }
private function createSmartUserAccess(Collection $row, DadosCadastrais $client, string $email): void private function createSmartUserAccess(Collection $row, DadosCadastrais $client, string $email): void
@ -90,13 +96,18 @@ class UsersWithSmartUsersImport implements ToCollection
? $this->files_paths[$client_id] ? $this->files_paths[$client_id]
: ''; : '';
User::create(\compact( /**
* @var ?\App\Models\User $user
*/
$user = User::create(\compact(
'client_id', 'client_id',
'name', 'name',
'email', 'email',
'password', 'password',
'profile_picture' 'profile_picture'
)); ));
$user?->roles()?->sync([2]);
} }
private function uploadProfilePictures() private function uploadProfilePictures()

View File

@ -3,7 +3,6 @@
namespace App\Mail; namespace App\Mail;
use Illuminate\Bus\Queueable; use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable; use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels; use Illuminate\Queue\SerializesModels;

30
app/Mail/TempMail.php Normal file
View File

@ -0,0 +1,30 @@
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
use Illuminate\Queue\SerializesModels;
class TempMail extends Mailable
{
use Queueable, SerializesModels;
public function __construct(public string $name, public string $password, public bool $has_password = true)
{
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->subject("Recuperação de Senha")->markdown('emails.temp-email');
}
}

View File

@ -0,0 +1,65 @@
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Gate;
use Laravel\Telescope\IncomingEntry;
use Laravel\Telescope\Telescope;
use Laravel\Telescope\TelescopeApplicationServiceProvider;
class TelescopeServiceProvider extends TelescopeApplicationServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
// Telescope::night();
$this->hideSensitiveRequestDetails();
Telescope::filter(function (IncomingEntry $entry) {
if ($this->app->environment('local')) {
return true;
}
return $entry->isReportableException() ||
$entry->isFailedRequest() ||
$entry->isFailedJob() ||
$entry->isScheduledTask() ||
$entry->hasMonitoredTag();
});
}
/**
* Prevent sensitive request details from being logged by Telescope.
*/
protected function hideSensitiveRequestDetails(): void
{
if ($this->app->environment('local')) {
return;
}
Telescope::hideRequestParameters(['_token']);
Telescope::hideRequestHeaders([
'cookie',
'x-csrf-token',
'x-xsrf-token',
]);
}
/**
* Register the Telescope gate.
*
* This gate determines who can access Telescope in non-local environments.
*/
protected function gate(): void
{
Gate::define('viewTelescope', function () {
return in_array(request()->query('email'), [
'smart_admin_monitor@energiasmart.com.br'
]);
});
}
}

View File

@ -5,7 +5,6 @@ declare(strict_types=1);
namespace App\Repositories\DadosCadastrais; namespace App\Repositories\DadosCadastrais;
use App\Models\DadosCadastrais; use App\Models\DadosCadastrais;
use App\Models\DadosTe;
use App\Repositories\AbstractRepository; use App\Repositories\AbstractRepository;

View File

@ -7,14 +7,11 @@ namespace App\Repositories\Economy;
use App\Helpers\Helpers; use App\Helpers\Helpers;
use App\Models\Economy; use App\Models\Economy;
use App\Repositories\AbstractRepository; use App\Repositories\AbstractRepository;
use Carbon\Carbon;
use DateInterval;
use DatePeriod;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Collection;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
class EconomyRepository extends AbstractRepository implements EconomyContractInterface class EconomyRepository extends AbstractRepository implements EconomyContractInterface
{ {
@ -48,8 +45,8 @@ class EconomyRepository extends AbstractRepository implements EconomyContractInt
]; ];
return $this->execute($params, $field) return $this->execute($params, $field)
->where(DB::raw( ->where(
"TO_DATE(economia.mes, 'YYMM')"), DB::raw("TO_DATE(economia.mes, 'YYMM')"),
">=", ">=",
DB::raw("TO_DATE(TO_CHAR(current_date , 'YYYY-12-01'), 'YYYY-MM-DD') - interval '1' year")) DB::raw("TO_DATE(TO_CHAR(current_date , 'YYYY-12-01'), 'YYYY-MM-DD') - interval '1' year"))
->where(function ($query) { ->where(function ($query) {

View File

@ -17,7 +17,9 @@ class NotificationRepository extends AbstractRepository implements NotificationC
public function getNotify(): int public function getNotify(): int
{ {
return Notifications::query()->with('users') return Notifications::query()
->whereRelation('users', 'id', '=', auth()->id())->count(); ->with('users')
->whereRelation('users', 'id', '=', auth()->id())
->count();
} }
} }

View File

@ -213,20 +213,23 @@ class PldRepository extends AbstractRepository implements PldContractInterface
} }
protected static function max($query){ protected static function max($query){
return $query->max(DB::raw("value")); return $query->max(DB::raw("value")) ?? 0;
} }
protected static function min($query){ protected static function min($query){
return $query->min(DB::raw("value")); return $query->min(DB::raw("value")) ?? 0;
} }
protected static function standardDeviation($query): float|bool protected static function standardDeviation($query): float|bool
{ {
$array = $query->addSelect([ /**
DB::raw("AVG(valor)as desv_pad") * @var \Illuminate\Support\Collection $devs_pad
])->get()->toArray(); */
$devs_pad = $query->addSelect([
DB::raw("AVG(valor) as desv_pad")
])->get();
return stats_standard_deviation(collect($array)->pluck('desv_pad')->all()); return $devs_pad->count() > 2 ? \stats_standard_deviation($devs_pad->pluck('desv_pad')->toArray()) : 0;
} }
} }

View File

@ -1,27 +0,0 @@
<?php
namespace App\Traits;
use Illuminate\Http\JsonResponse;
trait ApiResponse
{
protected function successResponse ($data, string $message = null, int $code = 200): JsonResponse
{
return response()->json([
'status' => 'Success',
'message' => $message,
'data' => $data
], $code);
}
protected function errorResponse ($data, string $message, int $code): JsonResponse
{
return response()->json([
'status' => 'Error',
'message' => $message,
'data' => $data
], $code);
}
}

View File

@ -14,6 +14,7 @@
"guzzlehttp/guzzle": "^7.2", "guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^9.11", "laravel/framework": "^9.11",
"laravel/sanctum": "^2.14.1", "laravel/sanctum": "^2.14.1",
"laravel/telescope": "^4.17",
"laravel/tinker": "^2.7", "laravel/tinker": "^2.7",
"league/flysystem-aws-s3-v3": "^3.0", "league/flysystem-aws-s3-v3": "^3.0",
"maatwebsite/excel": "^3.1", "maatwebsite/excel": "^3.1",
@ -52,7 +53,7 @@
"post-update-cmd": [ "post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force" "@php artisan vendor:publish --tag=laravel-assets --ansi --force"
], ],
"post-root-package-install": [ "create-env": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
], ],
"generate-key": [ "generate-key": [
@ -60,22 +61,24 @@
], ],
"cached": [ "cached": [
"@php artisan optimize --ansi", "@php artisan optimize --ansi",
"@php artisan view:clear --ansi", "@php artisan config:cache --ansi",
"@php artisan route:cache --ansi",
"@php artisan view:cache --ansi", "@php artisan view:cache --ansi",
"@php artisan route:clear --ansi", "@php artisan event:cache --ansi",
"@php artisan event:cache --ansi" "@php artisan package:discover --ansi"
], ],
"clear-cached": [ "clear-cached": [
"@php artisan optimize:clear", "@php artisan optimize:clear --ansi",
"@php artisan cache:clear --ansi", "@php artisan cache:clear --ansi",
"@php artisan view:clear --ansi", "@php artisan view:clear --ansi",
"@php artisan route:clear --ansi", "@php artisan route:clear --ansi",
"@php artisan event:clear --ansi", "@php artisan event:clear --ansi",
"@php artisan config:clear --ansi", "@php artisan config:clear --ansi"
"@php artisan schedule:clear-cache --ansi"
], ],
"authorized-files": "sudo chown -R www-data:www-data storage/ bootstrap/cache/ public/ && sudo chown -R :www-data storage/", "queue": "@php artisan queue:listen --tries=2 --backoff=10 --timeout=60",
"dev": "@php artisan serve --host=0.0.0.0 --port=8080 --ansi" "schedule": "@php artisan schedule:work",
"authorized-files": "sudo chown -R www-data:www-data storage/ storage/framework/cache storage/framework/cache/data bootstrap/cache/ public/ && sudo chown -R :www-data storage/",
"dev": "@php artisan serve --host=0.0.0.0 --port=8181"
}, },
"extra": { "extra": {
"laravel": { "laravel": {

2521
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -198,6 +198,7 @@ return [
// App\Providers\BroadcastServiceProvider::class, // App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class, App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class, App\Providers\RouteServiceProvider::class,
App\Providers\TelescopeServiceProvider::class,
/* /*
* Laravel Auditing * Laravel Auditing

189
config/telescope.php Normal file
View File

@ -0,0 +1,189 @@
<?php
use Laravel\Telescope\Http\Middleware\Authorize;
use Laravel\Telescope\Watchers;
return [
/*
|--------------------------------------------------------------------------
| Telescope Domain
|--------------------------------------------------------------------------
|
| This is the subdomain where Telescope will be accessible from. If the
| setting is null, Telescope will reside under the same domain as the
| application. Otherwise, this value will be used as the subdomain.
|
*/
'domain' => env('TELESCOPE_DOMAIN'),
/*
|--------------------------------------------------------------------------
| Telescope Path
|--------------------------------------------------------------------------
|
| This is the URI path where Telescope will be accessible from. Feel free
| to change this path to anything you like. Note that the URI will not
| affect the paths of its internal API that aren't exposed to users.
|
*/
'path' => env('TELESCOPE_PATH', 'telescope'),
/*
|--------------------------------------------------------------------------
| Telescope Storage Driver
|--------------------------------------------------------------------------
|
| This configuration options determines the storage driver that will
| be used to store Telescope's data. In addition, you may set any
| custom options as needed by the particular driver you choose.
|
*/
'driver' => env('TELESCOPE_DRIVER', 'database'),
'storage' => [
'database' => [
'connection' => env('DB_CONNECTION', 'pgsql'),
'chunk' => 1000,
],
],
/*
|--------------------------------------------------------------------------
| Telescope Master Switch
|--------------------------------------------------------------------------
|
| This option may be used to disable all Telescope watchers regardless
| of their individual configuration, which simply provides a single
| and convenient way to enable or disable Telescope data storage.
|
*/
'enabled' => env('TELESCOPE_ENABLED', true),
/*
|--------------------------------------------------------------------------
| Telescope Route Middleware
|--------------------------------------------------------------------------
|
| These middleware will be assigned to every Telescope route, giving you
| the chance to add your own middleware to this list or change any of
| the existing middleware. Or, you can simply stick with this list.
|
*/
'middleware' => [
'web',
Authorize::class,
],
/*
|--------------------------------------------------------------------------
| Allowed / Ignored Paths & Commands
|--------------------------------------------------------------------------
|
| The following array lists the URI paths and Artisan commands that will
| not be watched by Telescope. In addition to this list, some Laravel
| commands, like migrations and queue commands, are always ignored.
|
*/
'only_paths' => [
// 'api/*'
],
'ignore_paths' => [
'livewire*',
'nova-api*',
'pulse*',
],
'ignore_commands' => [
//
],
/*
|--------------------------------------------------------------------------
| Telescope Watchers
|--------------------------------------------------------------------------
|
| The following array lists the "watchers" that will be registered with
| Telescope. The watchers gather the application's profile data when
| a request or task is executed. Feel free to customize this list.
|
*/
'watchers' => [
Watchers\BatchWatcher::class => env('TELESCOPE_BATCH_WATCHER', true),
Watchers\CacheWatcher::class => [
'enabled' => env('TELESCOPE_CACHE_WATCHER', true),
'hidden' => [],
],
Watchers\ClientRequestWatcher::class => env('TELESCOPE_CLIENT_REQUEST_WATCHER', true),
Watchers\CommandWatcher::class => [
'enabled' => env('TELESCOPE_COMMAND_WATCHER', true),
'ignore' => [],
],
Watchers\DumpWatcher::class => [
'enabled' => env('TELESCOPE_DUMP_WATCHER', true),
'always' => env('TELESCOPE_DUMP_WATCHER_ALWAYS', false),
],
Watchers\EventWatcher::class => [
'enabled' => env('TELESCOPE_EVENT_WATCHER', true),
'ignore' => [],
],
Watchers\ExceptionWatcher::class => env('TELESCOPE_EXCEPTION_WATCHER', true),
Watchers\GateWatcher::class => [
'enabled' => env('TELESCOPE_GATE_WATCHER', true),
'ignore_abilities' => [],
'ignore_packages' => true,
'ignore_paths' => [],
],
Watchers\JobWatcher::class => env('TELESCOPE_JOB_WATCHER', true),
Watchers\LogWatcher::class => [
'enabled' => env('TELESCOPE_LOG_WATCHER', true),
'level' => 'error',
],
Watchers\MailWatcher::class => env('TELESCOPE_MAIL_WATCHER', true),
Watchers\ModelWatcher::class => [
'enabled' => env('TELESCOPE_MODEL_WATCHER', true),
'events' => ['eloquent.*'],
'hydrations' => true,
],
Watchers\NotificationWatcher::class => env('TELESCOPE_NOTIFICATION_WATCHER', true),
Watchers\QueryWatcher::class => [
'enabled' => env('TELESCOPE_QUERY_WATCHER', true),
'ignore_packages' => true,
'ignore_paths' => [],
'slow' => 100,
],
Watchers\RedisWatcher::class => env('TELESCOPE_REDIS_WATCHER', true),
Watchers\RequestWatcher::class => [
'enabled' => env('TELESCOPE_REQUEST_WATCHER', true),
'size_limit' => env('TELESCOPE_RESPONSE_SIZE_LIMIT', 64),
'ignore_http_methods' => [],
'ignore_status_codes' => [],
],
Watchers\ScheduleWatcher::class => env('TELESCOPE_SCHEDULE_WATCHER', true),
Watchers\ViewWatcher::class => env('TELESCOPE_VIEW_WATCHER', true),
],
];

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 12 KiB

BIN
public/images/180207211.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
public/images/180307222.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 108 KiB

BIN
public/images/180602112.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

BIN
public/images/180912141.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

BIN
public/images/180926141.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 56 KiB

BIN
public/images/210726140.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 39 KiB

BIN
public/images/220127210.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

BIN
public/images/220203240.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

BIN
public/images/220628230.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
public/images/220921240.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

BIN
public/images/220922140.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

BIN
public/images/221017140.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
public/images/221025230.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 KiB

BIN
public/images/221129130.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

BIN
public/images/221212250.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

BIN
public/images/230113130.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

BIN
public/images/230117231.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

BIN
public/images/230117232.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
public/images/230117234.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
public/images/230126230.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
public/images/230131130.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

BIN
public/images/230201140.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

BIN
public/images/230208130.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
public/images/230209130.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

BIN
public/images/230306120.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

BIN
public/images/230306121.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
public/images/230307241.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
public/images/230327210.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

BIN
public/images/230406121.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

BIN
public/images/230406141.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
public/images/230406240.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

BIN
public/images/230410230.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

BIN
public/images/230418251.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

BIN
public/images/230503240.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
public/images/230509140.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

BIN
public/images/230517120.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
public/images/230517121.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
public/images/230522120.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 KiB

BIN
public/images/230605130.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

BIN
public/images/230613130.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
public/images/230616210.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
public/images/230628110.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
public/images/230629250.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

BIN
public/images/230630121.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
public/images/230630140.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Some files were not shown because too many files have changed in this diff Show More