GHosT
GHosT
FFilament
Created by GHosT on 9/28/2023 in #❓┊help
Is it a normal behavior of the Select component??
Thanks!!
15 replies
FFilament
Created by GHosT on 9/28/2023 in #❓┊help
Is it a normal behavior of the Select component??
It a very good news!! I'll be waiting a release👍
15 replies
FFilament
Created by GHosT on 9/28/2023 in #❓┊help
Is it a normal behavior of the Select component??
Thanks a lot for your answer, it confirms my assumption. I'll try your recommendations, but for me this functionality is not critical.
15 replies
FFilament
Created by GHosT on 9/28/2023 in #❓┊help
Is it a normal behavior of the Select component??
As I say above without call the Select::searchable() method it works correctly. It looks like a bug.
15 replies
FFilament
Created by GHosT on 9/28/2023 in #❓┊help
Is it a normal behavior of the Select component??
public static function builderSelectUsersAll(Builder $builder): Builder {
if (!array_reduce(
$builder->toBase()->columns ?? [],
fn(bool $carry, Expression $exp) => $carry |= preg_replace('/[\'"`]/', '', $exp->getValue(app(Grammar::class))) == 'users.*',
false
)) {
$builder->selectRaw('users.*');
}

return $builder;
}
public static function builderSelectUsersAll(Builder $builder): Builder {
if (!array_reduce(
$builder->toBase()->columns ?? [],
fn(bool $carry, Expression $exp) => $carry |= preg_replace('/[\'"`]/', '', $exp->getValue(app(Grammar::class))) == 'users.*',
false
)) {
$builder->selectRaw('users.*');
}

return $builder;
}
15 replies
FFilament
Created by GHosT on 9/28/2023 in #❓┊help
Is it a normal behavior of the Select component??
public static function conditionPossibleMentor(Builder $builder, Model|self $user): Builder {
return $builder
->leftJoin($builder->raw('`users` mentors'), 'mentors.id', 'users.mentor_id')
->whereNot(
$user->getTable() . '.' . $user->getKeyName(),
$user->getKey()
)
->where(fn(Builder $query) => $query
->orWhereNull('users.mentor_id')
->orWhere('users.mentor_id', $user->mentor_id)
->orWhere(fn(Builder $query) => $query
->whereNot('users.mentor_id', $user->getKey())
->whereNot('mentors.mentor_id', $user->getKey())
)
)
;
}

public static function statusOperational(Builder $builder): Builder {
return static::builderJoinStatus($builder)
->where(function (Builder $query) {
$query
->orWhere('user_statuses.is_operational', true)
->orWhereNull('user_statuses.is_operational');
})
;
}

public static function builderJoinStatus(Builder $builder, string $join_type = 'left'): Builder {
static::builderSelectUsersAll($builder);

$join = $join_type . 'Join';

if (!array_reduce(
$builder->toBase()->joins ?? [],
fn(bool $carry, JoinClause $clause) => $carry |= $clause->table == 'user_statuses',
false
)) {
$builder->{$join}('user_statuses', 'users.user_status_name', 'user_statuses.name');
}

return $builder;
}
public static function conditionPossibleMentor(Builder $builder, Model|self $user): Builder {
return $builder
->leftJoin($builder->raw('`users` mentors'), 'mentors.id', 'users.mentor_id')
->whereNot(
$user->getTable() . '.' . $user->getKeyName(),
$user->getKey()
)
->where(fn(Builder $query) => $query
->orWhereNull('users.mentor_id')
->orWhere('users.mentor_id', $user->mentor_id)
->orWhere(fn(Builder $query) => $query
->whereNot('users.mentor_id', $user->getKey())
->whereNot('mentors.mentor_id', $user->getKey())
)
)
;
}

public static function statusOperational(Builder $builder): Builder {
return static::builderJoinStatus($builder)
->where(function (Builder $query) {
$query
->orWhere('user_statuses.is_operational', true)
->orWhereNull('user_statuses.is_operational');
})
;
}

public static function builderJoinStatus(Builder $builder, string $join_type = 'left'): Builder {
static::builderSelectUsersAll($builder);

$join = $join_type . 'Join';

if (!array_reduce(
$builder->toBase()->joins ?? [],
fn(bool $carry, JoinClause $clause) => $carry |= $clause->table == 'user_statuses',
false
)) {
$builder->{$join}('user_statuses', 'users.user_status_name', 'user_statuses.name');
}

return $builder;
}
15 replies
FFilament
Created by GHosT on 9/28/2023 in #❓┊help
Is it a normal behavior of the Select component??
I don't post a code I post the screenshot. My methods has no relation to this but I attach it below.
15 replies
FFilament
Created by Csinesz on 8/7/2023 in #❓┊help
CheckboxList options set some value to checked
Hi, are you solve this??
67 replies
FFilament
Created by GHosT on 9/25/2023 in #❓┊help
Use a resource in the Select::relationship() method
No one can help?? Sadly😕
4 replies
FFilament
Created by GHosT on 9/25/2023 in #❓┊help
Use a resource in the Select::relationship() method
I don't find this in Filament documentation or Google. How to reuse a resource's logic??
4 replies