Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/Http/Controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class AdminController extends Controller
*
* @param Request $r
*
* @return view
* @return View
*/
public function dashboard( Request $r ): View
{
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/AppPasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public function feInit(): void
protected static function additionalRoutes( string $route_prefix ): void
{
Route::group( [ 'prefix' => 'admin/' . $route_prefix ], static function() use ( $route_prefix ) {
Route::get( 'history/{id}', 'AppPasswordController@history' )->name( $route_prefix . '@history' );
Route::get( 'history/{id}', [static::class, 'history'] )->name( $route_prefix . '@history' );
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function feInit(): void
protected static function additionalRoutes( string $route_prefix ): void
{
Route::group( [ 'prefix' => ( static::$is_admin_route ? 'admin/' : '' ) . $route_prefix ], static function() use ( $route_prefix ) {
Route::get( 'list/port/{cs}', 'ConsoleServer\ConsoleServerConnectionController@listPort' )->name( $route_prefix . '@listPort' );
Route::get( 'list/port/{cs}', [static::class, 'listPort'] )->name( $route_prefix . '@listPort' );
});
}

Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Customer/CustomerTagController.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ public function feInit(): void
protected static function additionalRoutes( string $route_prefix ): void
{
Route::group( [ 'prefix' => ( static::$is_admin_route ? 'admin/' : '' ) . $route_prefix ], static function() use ( $route_prefix ) {
Route::get( 'cust/{cust}', 'Customer\CustomerTagController@linkCustomer' )->name( $route_prefix . '@link-customer' );
Route::post( 'link/{cust}', 'Customer\CustomerTagController@link' )->name( $route_prefix . '@link' );
Route::get( 'cust/{cust}', [static::class, 'linkCustomer'] )->name( $route_prefix . '@link-customer' );
Route::post( 'link/{cust}', [static::class, 'link'] )->name( $route_prefix . '@link' );
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public function listPatchPanelPortHistoryFiles( Request $r, Customer $cust ) :
*
* @throws AuthorizationException
*/
public function create( Request $r, Customer $cust ): view
public function create( Request $r, Customer $cust ): View
{
$this->authorize( 'create', [ DocstoreCustomerDirectory::class, $cust ] );

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/DocstoreCustomer/FileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public function info( DocstoreCustomerFile $file )
*
* @throws AuthorizationException
*/
public function upload( Request $r, Customer $cust ): view
public function upload( Request $r, Customer $cust ): View
{
$this->authorize( 'create', DocstoreCustomerFile::class );

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/IpAddressController.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public function list( int $protocol, ?int $vid = null ): View
*
* @param int $protocol Protocol of the IP address
*
* @return view
* @return View
*/
public function create( int $protocol ): View
{
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Layer2AddressController.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ protected static function additionalRoutes( string $route_prefix ): Void
{
// NB: this route is marked as 'read-only' to disable normal CRUD operations. It's not really read-only.
Route::group( [ 'prefix' => ( static::$is_admin_route ? 'admin/' : '' ) . $route_prefix ], function() use ( $route_prefix ) {
Route::get( 'vlan-interface/{vli}', 'Layer2AddressController@forVlanInterface' )->name( $route_prefix . '@forVlanInterface' );
Route::get( 'vlan-interface/{vli}', [static::class, 'forVlanInterface'] )->name( $route_prefix . '@forVlanInterface' );
});
}

Expand Down
8 changes: 4 additions & 4 deletions app/Http/Controllers/RipeAtlas/MeasurementController.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,10 @@ public function feInit()
protected static function additionalRoutes( string $route_prefix ): void
{
Route::group( [ 'prefix' => $route_prefix ], function() use ( $route_prefix ) {
Route::get( 'matrix/{atlasRun}', 'RipeAtlas\MeasurementController@matrix' )->name( $route_prefix . '@matrix' );
Route::post('run/{atlasrun}', 'RipeAtlas\MeasurementController@runMeasurements' )->name( $route_prefix . '@run-measurements' );
Route::put( 'update/{atlasrun}', 'RipeAtlas\MeasurementController@updateMeasurements' )->name( $route_prefix . '@update-measurements' );
Route::put( 'stop-measurements/{atlasrun}', 'RipeAtlas\MeasurementController@stopMeasurements' )->name( $route_prefix . '@stop-measurements' );
Route::get( 'matrix/{atlasRun}', [static::class, 'matrix'] )->name( $route_prefix . '@matrix' );
Route::post('run/{atlasrun}', [static::class, 'runMeasurements'] )->name( $route_prefix . '@run-measurements' );
Route::put( 'update/{atlasrun}', [static::class, 'updateMeasurements'] )->name( $route_prefix . '@update-measurements' );
Route::put( 'stop-measurements/{atlasrun}', [static::class, 'stopMeasurements'] )->name( $route_prefix . '@stop-measurements' );
});
}

Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/RipeAtlas/RunController.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ public function feInit()
protected static function additionalRoutes( string $route_prefix ): void
{
Route::group( [ 'prefix' => $route_prefix ], function() use ( $route_prefix ) {
Route::get( 'add-step-2', 'RipeAtlas\RunController@addStep2' )->name( $route_prefix . '@add-step-2' );
Route::put( 'run/complete/{atlasrun}', 'RipeAtlas\RunController@completeRun' )->name( $route_prefix . '@complete-run' );
Route::get( 'add-step-2', [static::class, 'addStep2'] )->name( $route_prefix . '@add-step-2' );
Route::put( 'run/complete/{atlasrun}', [static::class, 'completeRun'] )->name( $route_prefix . '@complete-run' );
});
}

Expand Down
12 changes: 6 additions & 6 deletions app/Http/Controllers/Switches/SwitchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,14 +209,14 @@ protected static function additionalRoutes( string $route_prefix ): void
{
// NB: this route is marked as 'read-only' to disable normal CRUD operations. It's not really read-only.
Route::group( [ 'prefix' => ( static::$is_admin_route ? 'admin/' : '' ) . $route_prefix ], function() {
Route::get( 'create-by-snmp', 'Switches\SwitchController@addBySnmp' )->name( 'switch@create-by-snmp' );
Route::get( 'port-report/{switch}','Switches\SwitchController@portReport' )->name( "switch@port-report" );
Route::post( 'store-by-snmp', 'Switches\SwitchController@storeBySmtp' )->name( "switch@store-by-snmp" );
Route::get( 'create-by-snmp', [static::class, 'addBySnmp'] )->name( 'switch@create-by-snmp' );
Route::get( 'port-report/{switch}', [static::class, 'portReport'] )->name( "switch@port-report" );
Route::post( 'store-by-snmp', [static::class, 'storeBySmtp'] )->name( "switch@store-by-snmp" );
});

// never an admin route:
Route::group( [ 'prefix' => $route_prefix ], function() {
Route::get( 'configuration', 'Switches\SwitchController@configuration' )->name( "switch@configuration" );
Route::get( 'configuration', [static::class, 'configuration'] )->name( "switch@configuration" );
});

}
Expand Down Expand Up @@ -581,7 +581,7 @@ protected function preDelete() : bool
*
* @param Switcher $switch ID for the switch
*
* @return view
* @return View
*/
public function portReport( Switcher $switch ) : View
{
Expand Down Expand Up @@ -620,7 +620,7 @@ public function portReport( Switcher $switch ) : View
*
* @param Request $r
*
* @return view
* @return View
*
* @throws
*/
Expand Down
26 changes: 13 additions & 13 deletions app/Http/Controllers/Switches/SwitchPortController.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,16 @@ protected static function additionalRoutes( string $route_prefix ): void
{
// NB: this route is marked as 'read-only' to disable normal CRUD operations. It's not really read-only.
Route::group( [ 'prefix' => ( static::$is_admin_route ? 'admin/' : '' ) . $route_prefix ], static function() {
Route::get( 'unused-optics', 'Switches\SwitchPortController@unusedOptics' )->name( 'switch-port@unused-optics' );
Route::get( 'optic-inventory', 'Switches\SwitchPortController@opticInventory' )->name( 'switch-port@optic-inventory' );
Route::get( 'optic-list', 'Switches\SwitchPortController@opticList' )->name( 'switch-port@optic-list' );
Route::get( 'list-mau/{switch}', 'Switches\SwitchPortController@listMau' )->name( 'switch-port@list-mau' );
Route::get( 'op-status/{switch}', 'Switches\SwitchPortController@listOpStatus' )->name( 'switch-port@list-op-status' );
Route::get( 'snmp-poll/{switch}', 'Switches\SwitchPortController@snmpPoll' )->name( 'switch-port@snmp-poll' );

Route::post( 'set-type', 'Switches\SwitchPortController@setType' )->name( 'switch-port@set-type' );
Route::post( 'change-status', 'Switches\SwitchPortController@changeStatus' )->name( 'switch-port@change-status' );
Route::delete( 'delete-snmp-poll', 'Switches\SwitchPortController@deleteSnmpPoll' )->name( 'switch-port@delete-snmp-poll' );
Route::get( 'unused-optics', [static::class, 'unusedOptics'] )->name( 'switch-port@unused-optics' );
Route::get( 'optic-inventory', [static::class, 'opticInventory'] )->name( 'switch-port@optic-inventory' );
Route::get( 'optic-list', [static::class, 'opticList'] )->name( 'switch-port@optic-list' );
Route::get( 'list-mau/{switch}', [static::class, 'listMau'] )->name( 'switch-port@list-mau' );
Route::get( 'op-status/{switch}', [static::class, 'listOpStatus'] )->name( 'switch-port@list-op-status' );
Route::get( 'snmp-poll/{switch}', [static::class, 'snmpPoll'] )->name( 'switch-port@snmp-poll' );

Route::post( 'set-type', [static::class, 'setType'] )->name( 'switch-port@set-type' );
Route::post( 'change-status', [static::class, 'changeStatus'] )->name( 'switch-port@change-status' );
Route::delete( 'delete-snmp-poll', [static::class, 'deleteSnmpPoll'] )->name( 'switch-port@delete-snmp-poll' );
});
}

Expand Down Expand Up @@ -376,7 +376,7 @@ public function setUpUnusedOptics(): bool
/**
* Display the unused optics
*
* @return view
* @return View
*
* @throws
*/
Expand Down Expand Up @@ -850,9 +850,9 @@ public function setUpOpticList(): bool
/**
* Display the Optic list
*
* @return view
* @return View
*/
public function opticList(): view
public function opticList(): View
{
$this->setUpOpticList();

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/User/UserRememberTokenController.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ protected static function additionalRoutes( string $route_prefix ): void
{
// NB: this route is marked as 'read-only' to disable normal CRUD operations. It's not really read-only.
Route::group( [ 'prefix' => $route_prefix ], static function() use ( $route_prefix ) {
Route::delete( 'delete', 'User\UserRememberTokenController@delete' )->name( $route_prefix."@delete" );
Route::delete( 'delete', [static::class, 'delete'] )->name( $route_prefix."@delete" );
});
}

Expand Down
8 changes: 4 additions & 4 deletions app/Http/Controllers/VlanController.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ public function feInit(): void
protected static function additionalRoutes( string $route_prefix ): void
{
Route::group( [ 'prefix' => ( static::$is_admin_route ? 'admin/' : '' ) . $route_prefix ], static function() use ( $route_prefix ) {
Route::get( 'private', 'VlanController@listPrivate' )->name( $route_prefix . '@private' );
Route::get( 'private/infra/{infra}', 'VlanController@listPrivate' )->name( $route_prefix . '@privateInfra' );
Route::get( 'list/infra/{infra}', 'VlanController@listInfra' )->name( $route_prefix . '@infra' );
Route::get( 'list/infra/{infra}/public/{public}', 'VlanController@listInfra' )->name( $route_prefix . '@infraPublic' );
Route::get( 'private', [static::class, 'listPrivate'] )->name( $route_prefix . '@private' );
Route::get( 'private/infra/{infra}', [static::class, 'listPrivate'] )->name( $route_prefix . '@privateInfra' );
Route::get( 'list/infra/{infra}', [static::class, 'listInfra'] )->name( $route_prefix . '@infra' );
Route::get( 'list/infra/{infra}/public/{public}', [static::class, 'listInfra'] )->name( $route_prefix . '@infraPublic' );
});
}

Expand Down
29 changes: 13 additions & 16 deletions app/Utils/Http/Controllers/Frontend/EloquentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,25 +217,24 @@ abstract protected function feInit();
public static function routes(): void
{
// add leading slash to class name for absolute resolution:
$class = '\\' . static::class;
$route_prefix = self::route_prefix();

Route::group( [ 'prefix' => ( static::$is_admin_route ? 'admin/' : '' ) . $route_prefix ], static function() use ( $class, $route_prefix ) {
Route::get( 'list', $class . '@list' )->name( $route_prefix . '@list' );
Route::get( 'view/{id}', $class . '@view' )->name( $route_prefix . '@view' );
Route::group( [ 'prefix' => ( static::$is_admin_route ? 'admin/' : '' ) . $route_prefix ], static function() use ( $route_prefix ) {
Route::get( 'list', [static::class, 'list'] )->name( $route_prefix . '@list' );
Route::get( 'view/{id}', [static::class, 'view'] )->name( $route_prefix . '@view' );

if( !static::$read_only ) {
Route::get( 'create', $class . '@create' )->name( $route_prefix . '@create' );
Route::delete( 'delete/{id}', $class . '@delete' )->name( $route_prefix . '@delete' );
Route::get( 'create', [static::class, 'create'] )->name( $route_prefix . '@create' );
Route::delete( 'delete/{id}', [static::class, 'delete'] )->name( $route_prefix . '@delete' );
if( !static::$disable_edit ) {
Route::get( 'edit/{id}', $class . '@edit' )->name( $route_prefix . '@edit' );
Route::put( 'update/{id}', $class . '@update' )->name( $route_prefix . '@update' );
Route::get( 'edit/{id}', [static::class, 'edit'] )->name( $route_prefix . '@edit' );
Route::put( 'update/{id}', [static::class, 'update'] )->name( $route_prefix . '@update' );
}
Route::post( 'store', $class . '@' . static::$storeFn )->name( $route_prefix . '@store' );
Route::post( 'store', [static::class, static::$storeFn] )->name( $route_prefix . '@store' );
}
});

$class::additionalRoutes( $route_prefix );
static::additionalRoutes( $route_prefix );
}

/**
Expand All @@ -245,13 +244,11 @@ public static function routes(): void
*/
public static function route_prefix(): ?string
{
$class = static::class;

if( $class::$route_prefix ) {
return $class::$route_prefix;
if( static::$route_prefix ) {
return static::$route_prefix;
}

return Str::kebab( substr( class_basename( $class ), 0, -10 ) );
return Str::kebab( substr( class_basename( static::class ), 0, -10 ) );
}

/**
Expand Down Expand Up @@ -442,7 +439,7 @@ public function create(): View
*
* @param int $id ID of the object to edit
*
* @return view
* @return View
*
* @throws GeneralException
*/
Expand Down
Loading