Scott
Scott
FFilament
Created by Scott on 10/24/2023 in #❓┊help
Only allow a single tenant
No description
3 replies
FFilament
Created by Scott on 10/9/2023 in #❓┊help
Disable "create another" on form (non modal)
I only want to let users create a single item for a model, but in the form it shows "Create and create another". I know you can disable this for a modal Action, but how do you disable it for a regular form?
8 replies
FFilament
Created by Scott on 9/22/2023 in #❓┊help
Action button within Custom Table Column
No description
4 replies
FFilament
Created by Scott on 9/8/2023 in #❓┊help
Show a "preview" within an action modal
No description
7 replies
FFilament
Created by Scott on 8/9/2023 in #❓┊help
Add a notice to the top of a table page
28 replies
FFilament
Created by Scott on 8/2/2023 in #❓┊help
How do you get the current tenant id?
I'd like to get the current team id (team = my tenant) when in a controller, e.g.
<?php

namespace App\Http\Controllers;

use App\Models\Team;
use Filament\Facades\Filament;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Log;

class AirtableOAuthController extends Controller
{
public function connect(Request $request)
{
$tenant = Filament::getTenant(Team::class);
dd($tenant);
}
}
<?php

namespace App\Http\Controllers;

use App\Models\Team;
use Filament\Facades\Filament;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Log;

class AirtableOAuthController extends Controller
{
public function connect(Request $request)
{
$tenant = Filament::getTenant(Team::class);
dd($tenant);
}
}
But it's returning "null" (also returns null if I just do Filament::getTenant();
5 replies
FFilament
Created by Scott on 7/31/2023 in #❓┊help
Show error via redirect
Hi guys, I need to show an error if something goes wrong during an oauth2 authentication flow within our app. Is there a way to show an error on redirect? E.g.
} catch (\Exception $e) {
// Log the exception message for debugging purposes
Log::error('Airtable OAuth callback error: ' . $e->getMessage());

return redirect('/admin/airtable-accounts')->with('error', 'Failed to connect with Airtable. Please try again.');
}
} catch (\Exception $e) {
// Log the exception message for debugging purposes
Log::error('Airtable OAuth callback error: ' . $e->getMessage());

return redirect('/admin/airtable-accounts')->with('error', 'Failed to connect with Airtable. Please try again.');
}
3 replies
FFilament
Created by Scott on 7/30/2023 in #❓┊help
Registration?
Hi guys - perhaps I'm missing something obvious, but don't see anything in the docs. How do we enable a registration form on filament (I'm using v3)
5 replies
FFilament
Created by Scott on 7/28/2023 in #❓┊help
Setting section background color
9 replies
FFilament
Created by Scott on 7/28/2023 in #❓┊help
Dynamically setting a label on a relationship
Hi guys, I have a table column which shows related sites. It outputs really nicely when doing this:
Tables\Columns\TextColumn::make('sites.woocommerce_url')
->listWithLineBreaks()
->bulleted()
Tables\Columns\TextColumn::make('sites.woocommerce_url')
->listWithLineBreaks()
->bulleted()
However, I want to conditionally show a message if no sites have been connected yet. When trying to do this, I get the following error message: Attempt to read property "sites" on null
Tables\Columns\TextColumn::make('sites')
->label(function($record) {
if($record->sites->isEmpty()) {
return '<a href="/sites/create">Create Site</a>';
} else {
return $record->sites->pluck('woocommerce_url')->take(3)->join('<br/>');
}
})
Tables\Columns\TextColumn::make('sites')
->label(function($record) {
if($record->sites->isEmpty()) {
return '<a href="/sites/create">Create Site</a>';
} else {
return $record->sites->pluck('woocommerce_url')->take(3)->join('<br/>');
}
})
Any ideas what I'm doing wrong here?
4 replies
FFilament
Created by Scott on 7/27/2023 in #❓┊help
How to create another panel?!
Hi guys, perhaps I'm being a bit stupid, but I don't see in the docs how to create additional panels: https://beta.filamentphp.com/docs/3.x/panels/getting-started#next-steps-with-the-panel-builder So I'd like an "admin" panel where I can manage users, and then a user panel where they can manage their own bits and pieces. I think that's the idea behind panels?
9 replies
FFilament
Created by Scott on 7/27/2023 in #❓┊help
Do hidden fields get processed?
Hi guys - I have a "user_id" field in a form. I want this value to be set to the current user, and the field should be hidden from view. Only admins should be able to see and edit this field. If I hide the field from non-admins, will the default still be set (it's a required field)? Forms\Components\Select::make('user_id') ->relationship('user', 'name') ->searchable() ->preload() ->placeholder('Select user') ->required(),
8 replies
FFilament
Created by Scott on 7/26/2023 in #❓┊help
Is there a way to conditionally disable the new post button?
17 replies
FFilament
Created by Scott on 7/26/2023 in #❓┊help
Primary Color for v3?
Hi guys, I'm trying to set the primary colour for buttons etc on the new v3. When looking at the docs it says you can use an array: https://beta.filamentphp.com/docs/3.x/support/colors But I'm getting an error Filament\Support\Colors\ColorManager::Filament\Support\Colors\{closure}(): Argument #1 ($color) must be of type string, array given
<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Database\Eloquent\Model;
use Filament\Support\Colors\Color;
use Filament\Support\Facades\FilamentColor;

class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}

/**
* Bootstrap any application services.
*/
public function boot(): void
{
// Disable mass assignment protection. Filament handles this
Model::unguard();

FilamentColor::register([
'danger' => Color::Red,
'gray' => Color::hex('#694398'),
'info' => Color::Blue,
'primary' => [
50 => Color::hex('#694398'),
100 => Color::hex('#694398'),
200 => Color::hex('#694398'),
300 => Color::hex('#694398'),
400 => Color::hex('#694398'),
500 => Color::hex('#694398'),
600 => Color::hex('#694398'),
700 => Color::hex('#694398'),
800 => Color::hex('#694398'),
900 => Color::hex('#694398'),
950 => Color::hex('#694398'),
],
'success' => Color::Green,
'warning' => Color::Amber,
]);
}
}
<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Database\Eloquent\Model;
use Filament\Support\Colors\Color;
use Filament\Support\Facades\FilamentColor;

class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}

/**
* Bootstrap any application services.
*/
public function boot(): void
{
// Disable mass assignment protection. Filament handles this
Model::unguard();

FilamentColor::register([
'danger' => Color::Red,
'gray' => Color::hex('#694398'),
'info' => Color::Blue,
'primary' => [
50 => Color::hex('#694398'),
100 => Color::hex('#694398'),
200 => Color::hex('#694398'),
300 => Color::hex('#694398'),
400 => Color::hex('#694398'),
500 => Color::hex('#694398'),
600 => Color::hex('#694398'),
700 => Color::hex('#694398'),
800 => Color::hex('#694398'),
900 => Color::hex('#694398'),
950 => Color::hex('#694398'),
],
'success' => Color::Green,
'warning' => Color::Amber,
]);
}
}
23 replies
FFilament
Created by Scott on 7/26/2023 in #❓┊help
Show information / notices above a form?
14 replies
FFilament
Created by Scott on 7/26/2023 in #❓┊help
beforeSave / mutateFormDataBeforeSave on a Resource (v3)
Hi guys, I need to execute some code prior to a record saving (both on initial save and update), but I can't seem to find any documentation for v3 which shows how to do this. I've tried doing what is outlined in the v2 docs, but it doesn't seem to be getting called. I'm adding the beforeSave / mutateFormDataBeforeSave functions in the Resource class for my model. Any ideas what I should be doing here?
11 replies