Skip to content

Commit

Permalink
Merge pull request #54 from kawanks/issue_53
Browse files Browse the repository at this point in the history
Atualizando framework para Laravel 11
  • Loading branch information
thiagogomesverissimo authored Aug 23, 2024
2 parents eae19fe + 6ad1d4d commit 14aaa79
Show file tree
Hide file tree
Showing 21 changed files with 3,072 additions and 2,422 deletions.
4 changes: 2 additions & 2 deletions app/Http/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Kernel extends HttpKernel
protected $middleware = [
// \App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class,
\Fruitcake\Cors\HandleCors::class,
\Illuminate\Http\Middleware\HandleCors::class,
\App\Http\Middleware\PreventRequestsDuringMaintenance::class,
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
\App\Http\Middleware\TrimStrings::class,
Expand Down Expand Up @@ -53,7 +53,7 @@ class Kernel extends HttpKernel
*
* @var array<string, class-string|string>
*/
protected $routeMiddleware = [
protected $middlewareAliases = [
'auth' => \App\Http\Middleware\Authenticate::class,
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class,
Expand Down
2 changes: 0 additions & 2 deletions app/Models/Grupo.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

use App\Models\Grupo;

use Uspdev\Replicado\DB;

class Grupo extends Model
Expand Down
6 changes: 2 additions & 4 deletions app/Providers/AuthServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@ class AuthServiceProvider extends ServiceProvider
*/
public function boot()
{
$this->registerPolicies();

Gate::define('logado', function ($user) {
return true;
return true;
});

Gate::define('owner', function ($user, $codpes) {
if(Gate::allows('admin')) return True;
return $user->codpes == $codpes;
});
}
}
}
14 changes: 7 additions & 7 deletions app/Utils/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
class Util
{

public function compute($codpes, $in, $out){
public static function compute($codpes, $in, $out){
$period = CarbonPeriod::between($in, $out);
$computes = [];

Expand Down Expand Up @@ -64,7 +64,7 @@ public function compute($codpes, $in, $out){
return $computes;
}

public function computeTotal($computes){
public static function computeTotal($computes){
$minutes = 0;
foreach($computes as $day){
foreach($day as $entries){
Expand All @@ -76,7 +76,7 @@ public function computeTotal($computes){
return self::formatMinutes($minutes);
}

public function formatMinutes($minutes){
public static function formatMinutes($minutes){
$h = floor($minutes / 60);
$m = $minutes - floor($minutes / 60) * 60;
if($h == 1 and $m == 1) return "{$h} hora e ${m} minuto";
Expand All @@ -91,7 +91,7 @@ public function formatMinutes($minutes){
return "{$h} horas e ${m} minutos";
}

public function computeDayMinutes($computes, $day) {
public static function computeDayMinutes($computes, $day) {
$minutos_do_dia = 0;
$registros = '';

Expand All @@ -118,7 +118,7 @@ public function computeDayMinutes($computes, $day) {
* @param string $dia
* @return array $feriado
*/
public function obterFeriado($dia) {
public static function obterFeriado($dia) {
$dia = Carbon::createFromFormat('Y-m-d', $dia);
$ano = $dia->format('Y');
$url = 'https://api.invertexto.com/v1/holidays/' . $ano . '?token=' . config('ponto.tokenInvertexto') . '&state=' . config('ponto.ufFeriados');
Expand All @@ -145,7 +145,7 @@ public function obterFeriado($dia) {
* @param string $out
* @return int $dias
*/
public function contarDiasUteis($in, $out) {
public static function contarDiasUteis($in, $out) {
$in = Carbon::createFromFormat('d/m/Y', $in);
$out = Carbon::createFromFormat('d/m/Y', $out);
$periodo = CarbonPeriod::between($in, $out);
Expand All @@ -165,7 +165,7 @@ public function contarDiasUteis($in, $out) {
* @param string $out
* @return array $datas
*/
public function listarDiasUteis($in, $out) {
public static function listarDiasUteis($in, $out) {
$in = Carbon::createFromFormat('d/m/Y', $in);
$out = Carbon::createFromFormat('d/m/Y', $out);
$periodo = CarbonPeriod::between($in->format('Y-m-d'), $out->format('Y-m-d'));
Expand Down
13 changes: 6 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"php": "^7.3|^8.0",
"php": "^8.2",
"barryvdh/laravel-dompdf": "^2.0",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.75",
"laravel/sanctum": "^2.11",
"laravel/framework": "^11.0",
"laravel/sanctum": "^4.0",
"laravel/tinker": "^2.5",
"symfony/filesystem": "^5.4",
"uspdev/laravel-usp-faker": "^1.0",
Expand All @@ -20,13 +19,13 @@
"uspdev/wsfoto": "^2.0"
},
"require-dev": {
"facade/ignition": "^2.5",
"spatie/laravel-ignition": "^2.0",
"fakerphp/faker": "^1.9.1",
"laravel/sail": "^1.0.1",
"lucascudo/laravel-pt-br-localization": "^1.2",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^5.10",
"phpunit/phpunit": "^9.5.10"
"nunomaduro/collision": "^8.1",
"phpunit/phpunit": "^10.0"
},
"autoload": {
"psr-4": {
Expand Down
Loading

0 comments on commit 14aaa79

Please sign in to comment.