Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
danharrin committed Nov 29, 2021
1 parent e227513 commit 41fc242
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/Http/Middleware/Authenticate.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Filament\Http\Middleware;

use Exception;
use Filament\Models\Contracts\FilamentUser;
use Illuminate\Auth\Middleware\Authenticate as Middleware;

Expand Down
14 changes: 11 additions & 3 deletions src/Pages/Actions/SelectAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,19 @@

namespace Filament\Pages\Actions;

use Illuminate\Contracts\Support\Arrayable;

class SelectAction extends Action
{
use Concerns\HasId;

protected string $view = 'filament::components.actions.select-action';

protected array $options = [];
protected array | Arrayable $options = [];

protected ?string $placeholder = null;

public function options(array $options): static
public function options(array | Arrayable $options): static
{
$this->options = $options;

Expand All @@ -28,7 +30,13 @@ public function placeholder(string $placeholder): static

public function getOptions(): array
{
return $this->options;
$options = $this->options;

if ($options instanceof Arrayable) {
$options = $options->toArray();
}

return $options;
}

public function getPlaceholder(): ?string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Filament\Resources\RelationManagers;

use Filament\Resources\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Arr;

class BelongsToManyRelationManager extends RelationManager
Expand Down Expand Up @@ -89,4 +90,10 @@ protected function save(): void

$this->callHook('afterSave');
}

// https://github.com/laravel/framework/issues/4962
public function applySelectToTableQuery(Builder $query): Builder
{
return $query->select($this->getRelationship()->getTable().'.*', $query->getModel()->getTable().'.*');
}
}

0 comments on commit 41fc242

Please sign in to comment.