dusan8061
dusan8061
FFilament
Created by dusan8061 on 7/24/2023 in #❓┊help
Terms and conditions
Hello guys! I have a problem and not sure how to solve it. I have a page and livewire component Terms and Conditions. What i need is, when user registers for the first time, it should take him to the page where Terms and Conditions are declared, and there is a checkbox which looks like that :
public function submit(): \Illuminate\Http\RedirectResponse|\Illuminate\Contracts\Foundation\Application|\Illuminate\Routing\Redirector
{
$data = $this->form->getState();

// Check if the user is logged in and if terms_and_conditions is set.
if (auth()->check() && isset($data['terms_and_conditions']) && $data['terms_and_conditions']) {
// Update the terms_and_conditions field for the user.
auth()->user()->update(['terms_and_conditions' => $data['terms_and_conditions']]);

// Flash a session message to indicate terms were accepted.
session()->flash('accepted', true);

// Redirect to the /admin page.
return redirect('/admin');
} else {
// If the user does not accept the terms and conditions, send them to a 403 page.
abort(403, 'You must accept the terms and conditions to use this service.');
}
}
public function submit(): \Illuminate\Http\RedirectResponse|\Illuminate\Contracts\Foundation\Application|\Illuminate\Routing\Redirector
{
$data = $this->form->getState();

// Check if the user is logged in and if terms_and_conditions is set.
if (auth()->check() && isset($data['terms_and_conditions']) && $data['terms_and_conditions']) {
// Update the terms_and_conditions field for the user.
auth()->user()->update(['terms_and_conditions' => $data['terms_and_conditions']]);

// Flash a session message to indicate terms were accepted.
session()->flash('accepted', true);

// Redirect to the /admin page.
return redirect('/admin');
} else {
// If the user does not accept the terms and conditions, send them to a 403 page.
abort(403, 'You must accept the terms and conditions to use this service.');
}
}
So the idea is, when he gets there, he should be still able to see the look of filament, but absolutely nothing else that Terms and conditions and checkbox. The blade file :
<div>
<form wire:submit.prevent="submit">
{{ $this->form }}

<button type="submit">
Submit
</button>
</form>

{{ $this->modal }}
</div>
<div>
<form wire:submit.prevent="submit">
{{ $this->form }}

<button type="submit">
Submit
</button>
</form>

{{ $this->modal }}
</div>
I'm literally running out of ideas, so looking forward to your answers!
8 replies
FFilament
Created by dusan8061 on 6/29/2023 in #❓┊help
Scrollable doesn't work
Hey, I'm experiencing problem with scroll bar on the bottom of the table on the resource page. Trying to find solution on the official documentation, but it says that should work by default. I don't have it on any browser, any resolutions, just it's not there. Also tried to add ->scrollable(true) function, and still nothing. Any suggestions? Many thanks, Dusan
9 replies
FFilament
Created by dusan8061 on 6/21/2023 in #❓┊help
Radio/Select
5 replies
FFilament
Created by dusan8061 on 5/31/2023 in #❓┊help
File upload error
3 replies
FFilament
Created by dusan8061 on 4/21/2023 in #❓┊help
Pre-select filters in table
Hey guys, I have widget Staff Widget. Depending on the role which user is logged in, I have to create pre-select filter in the table. So this is StaffWidget.php in widgets folder : protected function getTableColumns(): array { return [ Tables\Columns\TextColumn::make('name'), Tables\Columns\TextColumn::make('roles.name') ]; } and this is the code from UserResource.php : Forms\Components\TextInput::make('name')->required(), Forms\Components\TextInput::make('email')->required(), Forms\Components\Select::make('organisation')->relationship('organisation', 'name'), Bottom line, If I am logged in as a customer, role "customers" should be pre-selected on the Users overview page. Thanks in advance!
14 replies