BakaPresident
BakaPresident
Explore posts from servers
FFilament
Created by BakaPresident on 4/16/2024 in #❓┊help
How do I filter data by permission
I have a table of Orders. So i have OrderResource but how do i filter the order based on type. For example, my roles wheelchair should only be able to see the Order type wheelchair while admin is able to see everything Thanks in advance :(
14 replies
FFilament
Created by BakaPresident on 10/14/2023 in #❓┊help
Unable to show non numeric primary key in tables?
I have the current schema in
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('busnumber')
->required()
->maxLength(8),
Forms\Components\Select::make('driver_id')
->relationship('driver', 'name')
->required(),
Forms\Components\TextInput::make('model')
->required()
->maxLength(65535)
->columnSpanFull(),
Forms\Components\TextInput::make('maxpax')
->required()
->numeric()
->maxLength(65535)
->columnSpanFull(),
]);
}
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('busnumber')
->required()
->maxLength(8),
Forms\Components\Select::make('driver_id')
->relationship('driver', 'name')
->required(),
Forms\Components\TextInput::make('model')
->required()
->maxLength(65535)
->columnSpanFull(),
Forms\Components\TextInput::make('maxpax')
->required()
->numeric()
->maxLength(65535)
->columnSpanFull(),
]);
}
However, the busnumber seems to print out to 0 on the form. The rest is printing out fine. Could this be because busnumber is a primary key?
10 replies
CDCloudflare Developers
Created by BakaPresident on 8/19/2023 in #general-help
Cloudflare DNS returning redirect
Hi there, let me first preface this that I'm currently running it on my virtualmin server. My SSL certificate is currently generated by the Virtualmin panel which is Let's Encrypt. Whenever the proxy is turned on, i get
The page isn’t redirecting properly

An error occurred during a connection to dev-shiftbus.com.

This problem can sometimes be caused by disabling or refusing to accept cookies
The page isn’t redirecting properly

An error occurred during a connection to dev-shiftbus.com.

This problem can sometimes be caused by disabling or refusing to accept cookies
The website in question is dev-shiftbus.com
14 replies
CC#
Created by BakaPresident on 6/19/2023 in #help
❔ Getting Identity from [Authorize]
Hey there, since i'm using [Authorize] i thought i should be able to get UserID from var userId = HttpContext.User.FindFirstValue("nameid"); But userId keeps returning null. For context, this is how i build the claims in my AuthService
var claims = new List<Claim>
{
new Claim(JwtRegisteredClaimNames.Sub, user.Email),
new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()),
new Claim(JwtRegisteredClaimNames.Email, user.Email),
new Claim(JwtRegisteredClaimNames.NameId, user.Id)
}.Union(roleClaims).Union(userClaims);
var claims = new List<Claim>
{
new Claim(JwtRegisteredClaimNames.Sub, user.Email),
new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()),
new Claim(JwtRegisteredClaimNames.Email, user.Email),
new Claim(JwtRegisteredClaimNames.NameId, user.Id)
}.Union(roleClaims).Union(userClaims);
3 replies
CC#
Created by BakaPresident on 6/19/2023 in #help
❔ Entity Framework not required foreign key as required?
I'm currently using ASP.Net Identity as my user scaffold. My user currently looks like
public class User : IdentityUser
{
// Add additional data here
public string DisplayName { get; set; }

public ICollection<Bookshelf> Bookshelfs { get; } = new List<Bookshelf>();
}
public class User : IdentityUser
{
// Add additional data here
public string DisplayName { get; set; }

public ICollection<Bookshelf> Bookshelfs { get; } = new List<Bookshelf>();
}
I've added UserGenre and Genre like this.
public class Genre
{
public int Id { get; set; }
[Required]
public string Name { get; set; }

public List<UserGenre> UserGenres { get; } = new();
}
public class Genre
{
public int Id { get; set; }
[Required]
public string Name { get; set; }

public List<UserGenre> UserGenres { get; } = new();
}
public class UserGenre
{
public int Id { get; set; }

public string UserId { get; set; }
public User User { get; set; } = null!;

public int GenreId { get; set; }
public Genre Genre { get; set; } = null!;
}
public class UserGenre
{
public int Id { get; set; }

public string UserId { get; set; }
public User User { get; set; } = null!;

public int GenreId { get; set; }
public Genre Genre { get; set; } = null!;
}
6 replies