Glebka
Glebka
FFilament
Created by Glebka on 9/19/2024 in #❓┊help
Cant sort sidebar navigation items
No description
4 replies
FFilament
Created by Glebka on 9/5/2024 in #❓┊help
Change label of the save button in edit form
No description
8 replies
FFilament
Created by Glebka on 9/5/2024 in #❓┊help
filament.php config does not apply changes to buttons
No description
4 replies
FFilament
Created by Glebka on 9/5/2024 in #❓┊help
How to remove whitespace from groupAction?
No description
8 replies
FFilament
Created by Glebka on 9/4/2024 in #❓┊help
change table action hover behavior
No description
5 replies
FFilament
Created by Glebka on 8/29/2024 in #❓┊help
$record is null in table
No description
9 replies
FFilament
Created by Glebka on 8/27/2024 in #❓┊help
Can update password but can't see it in edit page
No description
9 replies
FFilament
Created by Glebka on 8/5/2024 in #❓┊help
ttp://vf.test/livewire/upload-file?expires=1722885986&signature=ebe591d90830e2a98241184850295c95095a
No description
5 replies
FFilament
Created by Glebka on 8/5/2024 in #❓┊help
Update input value of a resource form from a relation manager.
No description
4 replies
FFilament
Created by Glebka on 7/26/2024 in #❓┊help
How to access form variables (with $get) in a relationship?
I tried to use $get in a relationship, but it can't get a values from a parent form field, only those which are in repeater are accessible , is there any method to access parent form values in a repeater?
4 replies
FFilament
Created by Glebka on 7/19/2024 in #❓┊help
variable sending from livewire component to js code is not working
Hello, I am trying to send variable from livewire component to javascript code. I have a page with js code and @livewire component with it own class. I am using
<?php

namespace App\Livewire;

use Livewire\Component;
use App\Models\LearningUserStudyRecord;

class UserActivityForm extends Component
{
public $record;

public $video_start; // get data from db to set video start

public function mount(int | string $record): void
{
$this->record = LearningResource::findOrFail($record);
$this->sendVideoTime();
}

public function render()
{
return view('livewire.user-activity-form');
}

public function sendVideoTime(): void
{
$user = auth()->user()->id;
$userActivities = LearningUserStudyRecord::where('user_id', $user)
->where('resource_id', $this->record->id)
->get();

if ($userActivities->isEmpty()) {
$this->video_start = 0;
}

$latest_point = 20;
foreach ($userActivities as $activity) {
if ($activity->video_progress > $latest_point) {
$latest_point = $activity->video_progress;
}
}

$this->video_start = $latest_point;

$this->dispatch('video-start', latestPoint: $this->video_start);
}
}
<?php

namespace App\Livewire;

use Livewire\Component;
use App\Models\LearningUserStudyRecord;

class UserActivityForm extends Component
{
public $record;

public $video_start; // get data from db to set video start

public function mount(int | string $record): void
{
$this->record = LearningResource::findOrFail($record);
$this->sendVideoTime();
}

public function render()
{
return view('livewire.user-activity-form');
}

public function sendVideoTime(): void
{
$user = auth()->user()->id;
$userActivities = LearningUserStudyRecord::where('user_id', $user)
->where('resource_id', $this->record->id)
->get();

if ($userActivities->isEmpty()) {
$this->video_start = 0;
}

$latest_point = 20;
foreach ($userActivities as $activity) {
if ($activity->video_progress > $latest_point) {
$latest_point = $activity->video_progress;
}
}

$this->video_start = $latest_point;

$this->dispatch('video-start', latestPoint: $this->video_start);
}
}
in one of the last code lines I am sending data ( I think here is the problem). Javascript code:

@script
<script>
document.addEventListener("livewire:initialized", function() {

$wire.on('video-start', (latestPoint) => {
latestWatchedTime = latestPoint;
console.log("Latest watched time:", latestWatchedTime);
});
})
</script>
@endscript

@script
<script>
document.addEventListener("livewire:initialized", function() {

$wire.on('video-start', (latestPoint) => {
latestWatchedTime = latestPoint;
console.log("Latest watched time:", latestWatchedTime);
});
})
</script>
@endscript
I thought that i catched data correctly, but i cant see even a console.log message. Can someone help, please?
18 replies
FFilament
Created by Glebka on 7/12/2024 in #❓┊help
Fill custom edit page form with data
<?php

namespace App\Filament\Resources\LearningCategoryResource\Pages;

use Filament\Forms\Form;
use App\Models\LearningResource;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\TextInput;
use Filament\Resources\Pages\EditRecord;
use App\Filament\Resources\LearningCategoryResource;
use Filament\Resources\Pages\Concerns\InteractsWithRecord;

class CustomEditResource extends EditRecord
{
use InteractsWithRecord;

protected static string $resource = LearningCategoryResource::class;

public function mount(int | string $record): void
{
$this->record = LearningResource::findOrFail($record);
}

public function form(Form $form): Form
{
return $form
->columns(12)
->schema([
Section::make('Resource information')
->columnSpan(12)
->columns(12)
->schema([
TextInput::make('name')
->label('Name')
->required()
->columnSpan(10),
]),
]);
}
}
<?php

namespace App\Filament\Resources\LearningCategoryResource\Pages;

use Filament\Forms\Form;
use App\Models\LearningResource;
use Filament\Forms\Components\Section;
use Filament\Forms\Components\TextInput;
use Filament\Resources\Pages\EditRecord;
use App\Filament\Resources\LearningCategoryResource;
use Filament\Resources\Pages\Concerns\InteractsWithRecord;

class CustomEditResource extends EditRecord
{
use InteractsWithRecord;

protected static string $resource = LearningCategoryResource::class;

public function mount(int | string $record): void
{
$this->record = LearningResource::findOrFail($record);
}

public function form(Form $form): Form
{
return $form
->columns(12)
->schema([
Section::make('Resource information')
->columnSpan(12)
->columns(12)
->schema([
TextInput::make('name')
->label('Name')
->required()
->columnSpan(10),
]),
]);
}
}
I have created a filament page, selected EditPage when filament asked me what kind of page is this going to be and now I am trying to fill the form with $record data, but I dont understand how to do that. Can someone help? This is a custom edit page for a relationManager, not a resource itself, so in a $resource and a mount function I have a different models.
6 replies
FFilament
Created by Glebka on 7/11/2024 in #❓┊help
How to make table rows with thumbnails?
No description
4 replies
FFilament
Created by Glebka on 7/4/2024 in #❓┊help
Filament 3 custom view page for relation manager class
Hi, I searched for a couple of hours and I still can't find information about how to create a custom page view, or just a view page, instead of a model view on a relation in Filament 3. I have created a resource and a relation (table under a resource record), but the only option is to create a modal view. I need a full page view. Can you help me or at least give me some tips? Can I use infolist() and getPages() methods in a RelationManager? Maybe I need to call some Action class, create a custom view and custom route,or is there a terminal command that allows creating a full page view for a RelationManager? Thanks!
24 replies