1. Go to this page and download the library: Download plusinfolab/logstation library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
plusinfolab / logstation example snippets
// config/logstation.php
'authorization' => [
'callback' => function ($request) {
// Example 1: Allow specific users
return in_array($request->user()?->email, [
'[email protected]',
'[email protected]',
]);
// Example 2: Use Laravel Gate
return Gate::allows('viewLogstation', $request->user());
// Example 3: Check user role
return $request->user()?->hasRole('admin');
// Example 4: Environment-based
return app()->environment(['local', 'staging']);
},
],
use Illuminate\Support\Facades\Gate;
Gate::define('viewLogstation', function ($user) {
return in_array($user->email, [
'[email protected]',
]);
});
// app/Policies/LogStationPolicy.php
public function view(?User $user): bool
{
return $user && $user->isAdmin();
}