Skip to content

Commit

Permalink
fix: filament user and post-login redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
joelbutcher committed Oct 12, 2023
1 parent 78e4f68 commit 57dd781
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Actions/Auth/Filament/AuthenticateOauthCallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ public function authenticate(string $provider, ProviderUser $providerAccount): R

$this->guard->login($user, Socialstream::hasRememberSessionFeatures());

return redirect()->route('filament.admin.pages.dashboard');
return redirect()->route('filament.admin.home');
}
}
22 changes: 14 additions & 8 deletions stubs/filament/app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@

namespace App\Models;

// use Illuminate\Contracts\Auth\MustVerifyEmail;

use Filament\Models\Contracts\FilamentUser;
use Filament\Panel;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use JoelButcher\Socialstream\HasConnectedAccounts;
use Laravel\Sanctum\HasApiTokens;

class User extends Authenticatable
class User extends Authenticatable implements FilamentUser
{
use HasApiTokens;
use HasApiTokens, HasFactory, Notifiable;
use HasConnectedAccounts;
use HasFactory;
use Notifiable;

/**
* The attributes that are mass assignable.
Expand All @@ -27,23 +29,27 @@ class User extends Authenticatable
];

/**
* The attributes that should be hidden for arrays.
* The attributes that should be hidden for serialization.
*
* @var array<int, string>
*/
protected $hidden = [
'password',
'remember_token',
'two_factor_recovery_codes',
'two_factor_secret',
];

/**
* The attributes that should be cast to native types.
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'email_verified_at' => 'datetime',
'password' => 'hashed',
];

public function canAccessPanel(Panel $panel): bool
{
return true;
}
}

0 comments on commit 57dd781

Please sign in to comment.