Renzo
Getting rid of create button
Hi,
I currently have 2 resource, MyApplicationResource & ReferralResource. I generated the ReferralResource but it uses the data from MyApplicationResource. Is there a way to get rid of the Create Referral button on my ReferralResource?
6 replies
Hiding a section based on Select field value
I have created a function where the 2nd section is hidden unless the Role selected from the 1st section is 'Vendor' which has an ID of '2'. It works fine, but when I edit a users with an existing 'Vendor' role. the 2nd section doesn't show up. I'd have to select a different role and select Vendor again for it to show up.
3 replies
Twilio Integration
Hey guys, I've been trying add SMS notification everytime a new user is created. I've already added
user_contact
on my user schema also added values on E.164 format. I've also defined my twilio variables on .ENV file.
TWILIO_ACCOUNT_SID=AC8c4bb20a1d51ae1a9a7134b1fb99eab2
TWILIO_AUTH_TOKEN=67ae0e279a32c1a4210a793368f35cb2
TWILIO_PHONE_NUMBER=+19389999868
For some reason, I'm not receiving any SMS, but I'm able to create data. Here's my Create code:
7 replies
Table Data Visibility
I created a dispatch system in Laravel Filament where users can assign Workorders to Vendors. I get all my Vendors from my User model which has a 'role' of 'Vendor'. I've also set up a relationship between my User and Workorder model.
Currently, all Workorders can be seen by the Vendors even if that WO is not assigned to them. I want to add a function where 'Vendors' can only see the Workorder that was assigned to them.
Here's what I did which is throwing me an error of: Cannot use "::class" on value of type null
public static function table(Table $table): Table
{
return $table
->query(function (Builder $query) {
// Base query that fetches all work orders
$baseQuery = $query->select('*')->from('workorders');
// If user is a Vendor, modify the base query to only include their work orders if (Auth::user()->hasRole('Vendor')) { return $baseQuery->where('user_id', Auth::id()); }
// Otherwise, return the base query return $baseQuery; })
// If user is a Vendor, modify the base query to only include their work orders if (Auth::user()->hasRole('Vendor')) { return $baseQuery->where('user_id', Auth::id()); }
// Otherwise, return the base query return $baseQuery; })
4 replies
Hide a Toggle field depending on Select option
For some reason, I can't make it work. Here's what I did:
Select::make('roles')
->relationship('roles', 'name')
->live(),
Toggle::make('is_admin')
->hidden(fn ($record) => !$record->roles->pluck('name')->contains('Vendor'))
41 replies
Pass 'Select' field values to other fields.
I have a dropdown which displays all my customer addresses. Now I also have a field on my form called RadiusFilter which is basically an address text box. What i want to happend is for the RadiusFilter to be dependent on the SelectFilter (Which contains all the addresses of the customers).
So let's say, I picked address '1' on the Select Filter, address '1' would automatically be inputted on the RadiusFilter textbox.
SelectFilter::make('Customer')
->relationship('customer','cus_address'),
RadiusFilter::make('radius')
->attribute('Customer'),
MapIsFilter::make('map'),
Sorry guys, been trying to find answers on the docs but I can't find anything.
8 replies