Plugins v2 cleanup (#16298)

* cleanup

* use Illuminate\Support\Facades\Auth;

* style

* add route:cache and revert

* add route:cache and revert

* fix   in pluginExample

* fix Example plugin

* style

* fix other Hooks with Illuminate\Contracts\Auth\Authenticatable

* style

* whitespace

* whitespace2

---------

Co-authored-by: Tony Murray <murraytony@gmail.com>
This commit is contained in:
PipoCanaja
2024-08-26 19:45:12 +02:00
committed by GitHub
parent a412845b22
commit 61ad4bfbbf
6 changed files with 29 additions and 7 deletions
+13
View File
@@ -28,4 +28,17 @@ class PortTab extends PortTabHook
'total' => $total_delta,
];
}
// The authorize method will determine if the user will see this tab or not
// if you want all users to see it, simple return true
public function authorize(\Illuminate\Contracts\Auth\Authenticatable $user, \App\Models\Port $port): bool
{
// you can check user's roles like this:
// return $user->can('admin');
// or use whatever you like. Including conditions on the \App\Models\Port $port of course
// return \Carbon\Carbon::now()->dayOfWeek == Carbon::THURSDAY; // only allowed access on Thursdays!
return true; // allow every logged in user to access
}
}