Samir
Samir
FFilament
Created by Samir on 12/20/2023 in #❓┊help
Action to a Livewire component not working.
thanks a lot @awcodes . this solved my problem.
8 replies
FFilament
Created by Samir on 12/20/2023 in #❓┊help
Action to a Livewire component not working.
Thanks for pointing this. But my code is still not working.
8 replies
FFilament
Created by Eth on 12/20/2023 in #❓┊help
GenericEmail not found
You can create as many mailables classes based on. how many different emails and its templates you need. Mine is one such which gets triggered when a buyer sends and inquiry email to a seller. When admin approves then email is sent to seller.
13 replies
FFilament
Created by Eth on 12/20/2023 in #❓┊help
GenericEmail not found
Hope it helps.
13 replies
FFilament
Created by Eth on 12/20/2023 in #❓┊help
GenericEmail not found
then create view file for your email body. in mailable class path for view blade file is generated. Mine is 'emails.buyer-inquiry-email' in resource/view/emails.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Product Inquiry Email</title>
<!-- Include Tailwind CSS styles -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css">
</head>
<body class="p-8 font-sans bg-gray-100">

<div class="max-w-md p-8 mx-auto bg-white rounded shadow-md">

<h2 class="mb-4 text-2xl font-bold">Product Inquiry</h2>

<p class="mb-4">Dear {{ $sellerName }},</p>

<p class="mb-2">You have received an inquiry for your product "{{ $productName }}" from {{ $buyerName }} in {{ $buyerCountry }}.</p>

<div class="mb-4">
<strong>Details:</strong>
<ul>
<li>Quantity: {{ $quantity }} {{ $unit }}</li>
<li>Destination Port: {{ $destinationPort }}</li>
</ul>
</div>

<div class="mb-4">
<strong>Buyer's Message:</strong>
<p>{{ $buyerMsg }}</p>
</div>

<p class="mb-4">Please respond to this inquiry by clicking the button below:</p>

<a href="#" class="inline-block px-4 py-2 text-white bg-green-500 rounded">Reply to Inquiry</a>

<p class="mt-4">Thank you for using our platform!</p>

</div>

</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Product Inquiry Email</title>
<!-- Include Tailwind CSS styles -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css">
</head>
<body class="p-8 font-sans bg-gray-100">

<div class="max-w-md p-8 mx-auto bg-white rounded shadow-md">

<h2 class="mb-4 text-2xl font-bold">Product Inquiry</h2>

<p class="mb-4">Dear {{ $sellerName }},</p>

<p class="mb-2">You have received an inquiry for your product "{{ $productName }}" from {{ $buyerName }} in {{ $buyerCountry }}.</p>

<div class="mb-4">
<strong>Details:</strong>
<ul>
<li>Quantity: {{ $quantity }} {{ $unit }}</li>
<li>Destination Port: {{ $destinationPort }}</li>
</ul>
</div>

<div class="mb-4">
<strong>Buyer's Message:</strong>
<p>{{ $buyerMsg }}</p>
</div>

<p class="mb-4">Please respond to this inquiry by clicking the button below:</p>

<a href="#" class="inline-block px-4 py-2 text-white bg-green-500 rounded">Reply to Inquiry</a>

<p class="mt-4">Thank you for using our platform!</p>

</div>

</body>
</html>
13 replies
FFilament
Created by Eth on 12/20/2023 in #❓┊help
GenericEmail not found
BuyerInquiryEmail mailable class
13 replies
FFilament
Created by Eth on 12/20/2023 in #❓┊help
GenericEmail not found
And then create a mailable class like I created in app\mail\BuyInquiryEmail.php using command
php artisan make:mail BuyInquiryEmail
php artisan make:mail BuyInquiryEmail
. I have also attached below code for generated BuyerInquiryEmail class.
13 replies
FFilament
Created by Eth on 12/20/2023 in #❓┊help
GenericEmail not found
use App\Mail\BuyerInquiryEmail;
use Illuminate\Support\Facades\Mail;

Tables\Actions\Action::make('Approve')
->action(function (Inquiry $record) {
$record->status = InquiryEmailStatusEnum::APPROVED;
$record->save();
Notification::make()
->title('Inquiry Approved successfully')
->success()
->send();
// $this->dispatch('inquiry-approved', title: $record->id);

$recipeintEmail = Inquiry::find($record->id)->buyer->email;
Mail::to($recipeintEmail)->send(new BuyerInquiryEmail($record));
})
->icon('heroicon-m-check-circle')
->hidden(fn (Inquiry $record) => $record->status === InquiryEmailStatusEnum::APPROVED),
use App\Mail\BuyerInquiryEmail;
use Illuminate\Support\Facades\Mail;

Tables\Actions\Action::make('Approve')
->action(function (Inquiry $record) {
$record->status = InquiryEmailStatusEnum::APPROVED;
$record->save();
Notification::make()
->title('Inquiry Approved successfully')
->success()
->send();
// $this->dispatch('inquiry-approved', title: $record->id);

$recipeintEmail = Inquiry::find($record->id)->buyer->email;
Mail::to($recipeintEmail)->send(new BuyerInquiryEmail($record));
})
->icon('heroicon-m-check-circle')
->hidden(fn (Inquiry $record) => $record->status === InquiryEmailStatusEnum::APPROVED),
13 replies
FFilament
Created by Eth on 12/20/2023 in #❓┊help
GenericEmail not found
BTW you can also check my implementation in how I use this mailable in my filament code.
13 replies
FFilament
Created by Eth on 12/20/2023 in #❓┊help
GenericEmail not found
This is just an example. You have to create a mailable class and replace the GenericEmail class with yours. You must go through Laravel mail documentation first and use mailable command to generate your class, write email body code and view. check this: https://laravel.com/docs/10.x/mail
13 replies
FFilament
Created by Samir on 12/18/2023 in #❓┊help
Unable to login to panels in Production
Thnaks @Dennis Koch . my issue is resolved. It was error at both end. Server configuration. And i had Livewire package installed alogside Filament which was not needed. so may be livewire conflicts.
6 replies
FFilament
Created by Ali on 12/16/2023 in #❓┊help
Deployment Error
I feel it is purely a server configuration issue. Are you on a shared or managed VPS host with limited control? It feels like it is a PHP versioning issue. Many times host providers especially shared hosts allow you to change the php version for domains and sub-domains using their Cpanel which changes the php version but your dependent packages and other settings still default to their base default php version. Do also check your database configuration. Like DB HOST.
66 replies
FFilament
Created by Samir on 11/27/2023 in #❓┊help
Filament Custom Page always shows admin panel navigation
Bingo. I got it working. Debugging shows that whenever a Filament Custom Page gets called from anywhere as a URL, the URL parameters passed by the caller are not used for automatically Initialise using the mount('ID or entire Instance as parameter') method in the Filament Custom Page class. URL parameters are present in a Filament Custom Page as a Super Global Variable which can be assessed Using $_GET[‘one_of the_url_parameters’] // You can pass ID as a parameter. Do not create route in web.php for Filament Custom Pages if used for logged-in users. Initialise using mount() like below:
public Product $product;
public $productId;
public function mount(): void
{
$this->productId = $_GET['productID'];
$this->product = Product::find($this->productId);
}


//mount($productID) // does not work or initialise.
public Product $product;
public $productId;
public function mount(): void
{
$this->productId = $_GET['productID'];
$this->product = Product::find($this->productId);
}


//mount($productID) // does not work or initialise.
Sharing my entire code in the attachment. This is applicable anywhere wherever one wants to call the Custom Filament Page from a URL
22 replies
FFilament
Created by Sourabh on 11/22/2023 in #❓┊help
Tailwind css are not working in custom page .
No. Your understanding is not correct. Filament comes bundled with Tailwind. It is just that in filament don't have all of Tailwind classes which are being used for the theme. In Tailwind you can define your presets which include only those classes which you want to use. Filament has created its own preset of selected classes. Unfortunately, there is no documentation on the website about tailwind preset classes used in Filament. So, you have to dig into the code. This is why Filament recommends creating your own theme for each panel. In each theme, you can either extend the existing theme (which is recommended) or you can entirely have your own theme with your set of classes.
22 replies
FFilament
Created by Sourabh on 11/22/2023 in #❓┊help
Tailwind css are not working in custom page .
Look into my commented section in my attached code, how I tried extending my theme.
22 replies
FFilament
Created by Sourabh on 11/22/2023 in #❓┊help
Tailwind css are not working in custom page .
Filament custom pages belong to a specific panel. From my understing, it will render the theme specific to the panel. If you have custom styles, you need to extend the theme. You need to extend tauwing.config.js in your resources/css/filament/<panel_folder>/. All your extra colors must extend. Then build again.
22 replies
FFilament
Created by Samir on 11/27/2023 in #❓┊help
Filament Custom Page always shows admin panel navigation
I got this code running in a modal containing Livewire component code. No changes. Just implemented the Livewire component instead of the filament custom page. This component is triggered through Modal action. The custom page is receiving an empty mount. I don't know why. In fact, I am unable to implement any Filament custom pages which need a mount parameter.
22 replies
FFilament
Created by Samir on 11/27/2023 in #❓┊help
Filament Custom Page always shows admin panel navigation
This error null occurs only when I try to change the slug and assign as slug = {$id}. When slug is commented out, I am repeatedly getting folowing error when link uses product ID as parameter: Illuminate\Contracts\Container\BindingResolutionException Unable to resolve dependency [Parameter #0 [ <required> $product_id ]] in class App\Filament\Buyer\Pages\ListProductSellers . As mentioned when I change parameter from product_id to product and change my mount accordingly. Then error is gone but my page has not table result data.
22 replies
FFilament
Created by Samir on 11/27/2023 in #❓┊help
Filament Custom Page always shows admin panel navigation
I am clueless why Product::find($produt_id) returing null. I changed my mount a bit. Instead of passing $product_id, I am now passing $product. In the link route now looks like below:
<a href="{{ route('filament.buyer.pages.list-product-sellers', ['product' => $product]) }}">View Sellers</a>
<a href="{{ route('filament.buyer.pages.list-product-sellers', ['product' => $product]) }}">View Sellers</a>
. All my error is gone but I dont have any table data. It says no sellers where as I can clearly see I have a list. I have following url showling in broser. http://localhost/buyer/list-product-sellers?product=381 . You can see it is clearly having product ID 381. In my original issue using route in web.php I have everything right but with admin panel sidebar.
22 replies
FFilament
Created by Samir on 11/27/2023 in #❓┊help
Filament Custom Page always shows admin panel navigation
Attched My custom Page class. Follwing link I am using from another component blade file to access my custom page
<a href="{{ route('filament.buyer.pages.list-product-sellers', ['product_id' => $product->id]) }}">View Sellers</a>
<a href="{{ route('filament.buyer.pages.list-product-sellers', ['product_id' => $product->id]) }}">View Sellers</a>
22 replies