Skip to content

Commit

Permalink
chore(deps): upgrade to Laravel 11
Browse files Browse the repository at this point in the history
  • Loading branch information
Tbaile committed Jul 1, 2024
1 parent 6123325 commit dd6cd16
Show file tree
Hide file tree
Showing 19 changed files with 905 additions and 1,585 deletions.
10 changes: 5 additions & 5 deletions app/Http/Controllers/HardwareController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ public function index(Request $request, string $installation)
// If search term is empty, return an empty view
if ($searchTerm === null || $searchTerm === '') {
return view('hardware', ['matchingHardware' => collect(),
'installation' => $installation,
'searchTerm' => $searchTerm]);
'installation' => $installation,
'searchTerm' => $searchTerm]);
}
// Perform a query to find all hardware that contain the search term
if ($installation === 'NethServer') {
Expand Down Expand Up @@ -106,8 +106,8 @@ public function index(Request $request, string $installation)

// Return view with grouped input matches, count, and rows count
return view('hardware', ['groupedInputMatch' => $groupedInputMatch,
'count' => $count,
'installation' => $installation,
'searchTerm' => $searchTerm]);
'count' => $count,
'installation' => $installation,
'searchTerm' => $searchTerm]);
}
}
65 changes: 33 additions & 32 deletions app/Http/Controllers/PciController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,53 @@

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Models\NethsecurityPCI;
use App\Models\NethserverPCI;
use Illuminate\Http\Request;

class PciController extends Controller
{
public function index(Request $request, string $installation){
public function index(Request $request, string $installation)
{
$pciSearch = $request->input('pci_search');
$pciHardwareMatch = [];
$count = 0;

if($pciSearch === null || $pciSearch === ''){
if ($pciSearch === null || $pciSearch === '') {
return view('hardwarePci', ['pciHardwareMatch' => collect(),
'installation' => $installation,
'pciSearch' => $pciSearch]);
'installation' => $installation,
'pciSearch' => $pciSearch]);
}

if($installation === 'NethSecurity'){
if(! empty($pciSearch)){
if (preg_match('/^[0-9a-fA-F]{4}:[0-9a-fA-F]{4}$/', $pciSearch)){
if ($installation === 'NethSecurity') {
if (! empty($pciSearch)) {
if (preg_match('/^[0-9a-fA-F]{4}:[0-9a-fA-F]{4}$/', $pciSearch)) {
$ids = explode(':', $pciSearch);
$vendorId = $ids[0];
$deviceId = $ids[1];

$pciHardwareMatch = NethsecurityPCI::where('vendor_id', $vendorId)
->where('device_id', $deviceId)
->get();
}else{
} else {
return view('hardwarePci', ['installation' => $installation, 'pciSearch' => $pciSearch])
-> with('error','The format of the PCI ID is incorrect. Make sure to enter a value in the correct
->with('error', 'The format of the PCI ID is incorrect. Make sure to enter a value in the correct
format (xxxx:xxxx), where xxxx represents a sequence of 4 hexadecimal characters.');
}
}
}else if($installation === 'NethServer'){
if(! empty($pciSearch)){
} elseif ($installation === 'NethServer') {
if (! empty($pciSearch)) {
if (preg_match('/^[0-9a-fA-F]{4}:[0-9a-fA-F]{4}$/', $pciSearch)) {
$ids = explode(':', $pciSearch);
$vendorId = $ids[0];
$deviceId = $ids[1];

$pciHardwareMatch = NethserverPCI::where('vendor_id', $vendorId)
->where('device_id', $deviceId)
->get();
}else {
return view('hardwarePci', ['installation' => $installation, 'pciSearch' => $pciSearch])
-> with('error','The format of the PCI ID is incorrect. Make sure to enter a value in the correct
} else {
return view('hardwarePci', ['installation' => $installation, 'pciSearch' => $pciSearch])
->with('error', 'The format of the PCI ID is incorrect. Make sure to enter a value in the correct
format (xxxx:xxxx), where xxxx represents a sequence of 4 hexadecimal characters.');
}
}
Expand All @@ -58,27 +59,27 @@ public function index(Request $request, string $installation){
$pciHardware = [];
$hardwareCounts = [];

foreach ($pciHardwareMatch as $hardware){
$key = $hardware->class_id . '_'
. $hardware->vendor_id . '_'
. $hardware->device_id . '_'
. $hardware->class_name . '_'
. $hardware->vendor_name . '_'
. $hardware->device_name . '_'
. $hardware->driver;
foreach ($pciHardwareMatch as $hardware) {
$key = $hardware->class_id.'_'
.$hardware->vendor_id.'_'
.$hardware->device_id.'_'
.$hardware->class_name.'_'
.$hardware->vendor_name.'_'
.$hardware->device_name.'_'
.$hardware->driver;

if(array_key_exists($key, $pciHardware)){
$hardwareCounts[$key]++;
}else{
if (array_key_exists($key, $pciHardware)) {
$hardwareCounts[$key]++;
} else {
$pciHardware[$key] = $hardware;
$hardwareCounts[$key] = 1;
}
}

return view('hardwarePci', ['pciHardware' => $pciHardware,
'count' => $count,
'installation' => $installation,
'hardwareCounts' => $hardwareCounts,
'pciSearch' => $pciSearch]);
'count' => $count,
'installation' => $installation,
'hardwareCounts' => $hardwareCounts,
'pciSearch' => $pciSearch]);
}
}
17 changes: 0 additions & 17 deletions app/Http/Middleware/EncryptCookies.php

This file was deleted.

17 changes: 0 additions & 17 deletions app/Http/Middleware/VerifyCsrfToken.php

This file was deleted.

4 changes: 1 addition & 3 deletions app/Logic/GeoIpLocatorImpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@

class GeoIpLocatorImpl implements GeoIpLocator
{
public function __construct(private Reader $resolver)
{
}
public function __construct(private Reader $resolver) {}

/**
* {@inheritdoc}
Expand Down
12 changes: 6 additions & 6 deletions app/Models/Installation.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ class Installation extends Model
'data->facts',
];

/**
* {@inheritdoc}
*/
protected $casts = [
'data' => 'array',
];
protected function casts(): array
{
return [
'data' => 'array',
];
}

/**
* Get the country associated with the Installation
Expand Down
2 changes: 1 addition & 1 deletion app/Models/NethsecurityPCI.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@

class NethsecurityPCI extends Model
{
protected $table= 'nethsecurity_pci';
protected $table = 'nethsecurity_pci';
}
2 changes: 1 addition & 1 deletion app/Models/NethserverPCI.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@

class NethserverPCI extends Model
{
protected $table= 'nethserver_pci';
protected $table = 'nethserver_pci';
}
11 changes: 7 additions & 4 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@ class User extends Authenticatable
/**
* The attributes that should be cast.
*
* @var array<string, string>
* @return array<string, string>
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
protected function casts(): array
{
return [
'email_verified_at' => 'datetime',
];
}
}
13 changes: 4 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,20 @@
"require": {
"php": "^8.3",
"ext-pcntl": "*",
"ext-pdo": "*",
"ext-pdo_pgsql": "*",
"ext-pgsql": "*",
"ext-posix": "*",
"ext-redis": "*",
"geoip2/geoip2": "^v2.13",
"geoip2/geoip2": "^v3.0",
"guzzlehttp/guzzle": "^7.8",
"laravel/framework": "^v10.21",
"laravel/sanctum": "^v3.2",
"laravel/framework": "^11.0",
"laravel/sanctum": "^4.0",
"laravel/tinker": "^v2.8",
"league/csv": "^9.10",
"opis/json-schema": "^2.3",
"pulkitjalan/geoip": "^6.0"
"pulkitjalan/geoip": "^7.0"
},
"require-dev": {
"barryvdh/laravel-ide-helper": "^v2.13",
"fakerphp/faker": "^v1.23",
"laravel/pint": "^v1.12",
"laravel/sail": "^v1.24",
"mockery/mockery": "^1.6",
"pestphp/pest": "^v2.16",
"pestphp/pest-plugin-laravel": "^v2.2",
Expand Down
Loading

0 comments on commit dd6cd16

Please sign in to comment.