Pede
Pede
FFilament
Created by Pede on 10/28/2024 in #❓┊help
Loading indicator on record change
Thank you for a quick response 😀 I'm using Laravel vapor so I think OPCache should be ok. Checked my code to reduce the loading time. Found a few places to improve however I want a loading spinner for the user experience on slower loads.
7 replies
FFilament
Created by Wim on 4/9/2024 in #❓┊help
Filament with Spark integration
@Wim
3 replies
FFilament
Created by Wim on 4/9/2024 in #❓┊help
Filament with Spark integration
Did you find a solution to this? I'm having the same problem.
3 replies
FFilament
Created by Pede on 3/31/2024 in #❓┊help
Table inline widget graph
Thanks for taking your time. I looked into this, however I don't like the style. I would like to keep a filament look and feel.
5 replies
FFilament
Created by Pede on 12/6/2023 in #❓┊help
Multi-Tenancy with Laravel Spark
Redirect is fixed in Spark release v4.2.11. Thank you @Nathan for reaching out to the Laravel Spark team.
6 replies
FFilament
Created by Pede on 12/6/2023 in #❓┊help
Multi-Tenancy with Laravel Spark
I was hopeing for some help 🥲 But sure here you go:
<?php

namespace App\Providers;

use App\Models\Team;
use Illuminate\Http\Request;
use Illuminate\Support\ServiceProvider;
use Illuminate\Validation\ValidationException;
use Spark\Plan;
use Spark\Spark;
use Laravel\Cashier\Cashier;
use Filament\Facades\Filament;

class SparkServiceProvider extends ServiceProvider
{

public function register(): void
{
Spark::ignoreMigrations();
}

public function boot(): void
{

// Instruct Cashier to use the `Team` model instead of the `User` model...
Cashier::useCustomerModel(Team::class);


// Resolve the current team...
Spark::billable(Team::class)->resolve(function (Request $request) {
return $request->user()->currentTeam;
});

// Verify that the current user owns the team...
Spark::billable(Team::class)->authorize(function (Team $billable, Request $request) {
return $request->user() &&
$request->user()->team_id == $billable->team_id;
});

Spark::billable(Team::class)->checkPlanEligibility(function (Team $billable, Plan $plan) {
// if ($billable->projects > 5 && $plan->name == 'Basic') {
// throw ValidationException::withMessages([
// 'plan' => 'You have too many projects for the selected plan.'
// ]);
// }
});
}
}
<?php

namespace App\Providers;

use App\Models\Team;
use Illuminate\Http\Request;
use Illuminate\Support\ServiceProvider;
use Illuminate\Validation\ValidationException;
use Spark\Plan;
use Spark\Spark;
use Laravel\Cashier\Cashier;
use Filament\Facades\Filament;

class SparkServiceProvider extends ServiceProvider
{

public function register(): void
{
Spark::ignoreMigrations();
}

public function boot(): void
{

// Instruct Cashier to use the `Team` model instead of the `User` model...
Cashier::useCustomerModel(Team::class);


// Resolve the current team...
Spark::billable(Team::class)->resolve(function (Request $request) {
return $request->user()->currentTeam;
});

// Verify that the current user owns the team...
Spark::billable(Team::class)->authorize(function (Team $billable, Request $request) {
return $request->user() &&
$request->user()->team_id == $billable->team_id;
});

Spark::billable(Team::class)->checkPlanEligibility(function (Team $billable, Plan $plan) {
// if ($billable->projects > 5 && $plan->name == 'Basic') {
// throw ValidationException::withMessages([
// 'plan' => 'You have too many projects for the selected plan.'
// ]);
// }
});
}
}
6 replies
FFilament
Created by sundays on 12/6/2023 in #❓┊help
Calculated fields in form builder
You can do it in your model with the following code:
public static function boot()
{
parent::boot();

self::creating(function($model){
// ---- add your code to calculate filesize ----

//Set attributes filesize to be the calculated value
$model->attributes['filesize'] = 954;
});
}
public static function boot()
{
parent::boot();

self::creating(function($model){
// ---- add your code to calculate filesize ----

//Set attributes filesize to be the calculated value
$model->attributes['filesize'] = 954;
});
}
4 replies
FFilament
Created by IranMine123 on 12/6/2023 in #❓┊help
Login/Register: Columns
4 replies