egmose5492dk
egmose5492dk
FFilament
Created by egmose5492dk on 4/10/2024 in #❓┊help
Only access to certain resulsts in resource - How do i limit that?
No description
3 replies
FFilament
Created by egmose5492dk on 12/30/2023 in #❓┊help
Add multiple translation to translation table
SOLVED Hi everyone, I've been working on a Laravel project and encountered a perplexing issue that I haven't been able to resolve, despite consulting with ChatGPT for assistance. I'm hoping someone here might be able to shed some light on it. Problem: I'm trying to add new translations to a translations table in my Laravel application. However, when I attempt to insert a new translation, I consistently receive the following error: Illuminate\Database\QueryException PHP 8.2.4 10.38.2 SQLSTATE[HY000]: General error: 1364 Field 'locale' doesn't have a default value INSERT INTO translations (key, updated_at, created_at) VALUES (123, 2023-12-30 20:01:10, 2023-12-30 20:01:10) Expected Behavior: My intention is for the system to insert one row per language into the database, all with the same key, but with different locale values. Current Observation: The locale value doesn't seem to be getting inserted, and I can't figure out why. This is leading to a failure due to the lack of a default value for the locale field. Relevant Code Snippet: Here's the Eloquent model for Translation: <?php namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class Translation extends Model { use HasFactory; protected $fillable = [ 'locale', 'key', 'value', ]; } TranslationResource : https://pastebin.com/4wMKuvgZ
8 replies
FFilament
Created by egmose5492dk on 12/25/2023 in #❓┊help
Filament Checkboxlist returns raw HTML
Im trying to make a dynamic checkboxlist. For each checkbox, i want to show an Font-Awesome icon. The issue is, that it just renders as a regular string. Any idea how to solve that? Tab::make('Faciliteter') ->schema([ Grid::make(1) ->schema([ CheckboxList::make('facilities') ->relationship('facilities', 'facility_name') ->getOptionLabelFromRecordUsing(function ($record) { return new HtmlString('<i class="fa fa-' . $record->facility_fa_icon . '"></i> ' . $record->facility_name); }) ->columns(5), ]), ]),
5 replies