Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new widget classes and update README for widgets protection #122

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,21 @@ use Coolsam\Modules\Page;
```
use the above page class instead of `use Filament/Pages/Page;` into your page class file to protect your pages.

```php
use Coolsam\Modules\TableWidget;
```
use the above page class instead of `use Filament/Pages/TableWidget;` into your widget class file to protect your TableWidget.

```php
use Coolsam\Modules\ChartWidget;
```
use the above page class instead of `use Filament/Pages/ChartWidget;` into your widget class file to protect your ChartWidget.

```php
use Coolsam\Modules\StatsOverviewWidget;
```
use the above page class instead of `use Filament/Pages/StatsOverviewWidget;` into your widget class file to protect your StatsOverviewWidget.

```php
use CanAccessTrait;
```
Expand Down
16 changes: 16 additions & 0 deletions src/ChartWidget.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Coolsam\Modules;


abstract class ChartWidget extends \Filament\Widgets\ChartWidget
{

use \Coolsam\Modules\Traits\CanAccessTrait;


public static function canView(): bool
{
return self::canAccess();
}
}
16 changes: 16 additions & 0 deletions src/StatsOverviewWidget.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Coolsam\Modules;


abstract class StatsOverviewWidget extends \Filament\Widgets\StatsOverviewWidget
{

use \Coolsam\Modules\Traits\CanAccessTrait;


public static function canView(): bool
{
return self::canAccess();
}
}
3 changes: 3 additions & 0 deletions src/TableWidget.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

namespace Coolsam\Modules;


abstract class TableWidget extends \Filament\Widgets\TableWidget
{

use \Coolsam\Modules\Traits\CanAccessTrait;


public static function canView(): bool
{
return self::canAccess();
Expand Down
Loading