Soundmit
translate routes in custom plugin
in my custom plugin, i have the web.php file for the routes
i would like to translate people when i choose another language, for example en: people it: persone
i've tried
but i get
because Laravel is trying to resolve the __() function before the service container is fully initialized, causing the error 'Target class [translator] does not exist.'
any solution or method for this?
thanks
3 replies
Translatable menu builder
Hi, i'm using this plugin to generateing he website menu (frontend not filament)
https://github.com/ryangjchandler/filament-navigation
but my website il multilanguage and this plugin is not translatable out of the box.
tried Tomatophp but i feel it too complicated.
There is another solution (not paid) to try before i'm starting to make my own menu plugin?
Thanks
3 replies
Best Practice when making new plugin
I'm building my first plugin!
In my website i need it translatable, but if i want to release it
should i add all the translation implementation in the plugin or leaving to the user the implementation?
and for translate i mean use Spatie\Translatable\HasTranslations; use Filament\Resources\Concerns\Translatable; etc
3 replies
Add Printjs to infolist action
Hi, in my app i have an infolist with a button 'print'
this action all a route that generate and show a pdf in the browser (same tab)
now i want to add printerjs in order to print it directly
i've added print js with npm
import in app.js
compiled with npm run build
and inspecting the code, the library seems to be loaded right
now
16 replies
Custom widget, passing variables to blade
I'm trying to make a custom widget (all other widgets works)
class
blade
$record in template works but i want to prepare the variable in my class and then send it to the tpl
but i tried several options, like mount, getData... no one works.
4 replies
getHEaderWidgetColumns not works in resource view
In my resource view, i have a stats widget wit 5 boxes divided in 2 rows 3 and 2
i want 5 block in a row, so i added getHeaderWidgetsColumns() to my widget but it doens't works
i want 5 columns only for this widget not for the otherd
``
<?php
namespace App\Filament\Resources\RepairResource\Widgets;
use Filament\Widgets\StatsOverviewWidget as BaseWidget;
use Filament\Widgets\StatsOverviewWidget\Stat;
class RepairOverview extends BaseWidget
{
public function getHeaderWidgetsColumns(): int | array
{
return 5;
}
protected function getStats(): array
{
$quote = 165;
$paid = 175;
$costs = 120;
$profit = $quote - $costs;
$finalProfit = $paid - $costs;
return [
Stat::make('Preventivo', $quote) ,
Stat::make('Incasso', $paid),
Stat::make('Costi', $costs),
Stat::make('Utile previsto', $profit),
Stat::make('Utile effettivo', $finalProfit)
->description('7% decrease'),
];
}
}
```
4 replies
Kernel.php in V3 t oregister middleware
I'm trying to use https://github.com/mcamara/laravel-localization
in filamentphp. At some point, i need t oregeister the middleware in the Kernel.php file but there is no Kernel.php file in v3
i need this middleware outside of the panel, in my frontend.
Do i need to override the Kernel.php cby creating a new file in App\Http or there is another way to register middleware?
https://github.com/mcamara/laravel-localization#register-middleware
You may register the package middleware in the app/Http/Kernel.php file:
<?php namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel {
/
* The application's route middleware.
*
* @var array
*/
protected $middlewareAliases = [
/** OTHER MIDDLEWARE **/
'localize' => \Mcamara\LaravelLocalization\Middleware\LaravelLocalizationRoutes::class,
'localizationRedirect' => \Mcamara\LaravelLocalization\Middleware\LaravelLocalizationRedirectFilter::class,
'localeSessionRedirect' => \Mcamara\LaravelLocalization\Middleware\LocaleSessionRedirect::class,
'localeCookieRedirect' => \Mcamara\LaravelLocalization\Middleware\LocaleCookieRedirect::class,
'localeViewPath' => \Mcamara\LaravelLocalization\Middleware\LaravelLocalizationViewPath::class
];
}
3 replies
Please help with frontend translation
I've decided to quit my 17 years job as developer because i can't find a way to translate a laravel frontend 🙂
Joke aside,
I'm able (80%) to set the language in the session with a language switcher
but i can't redirect to the translated page...
i use spatie/translatable and i have a page with
en slug: test-en
it slug: test-it
When in the english page i try to translate in italian
but the slug doesn't change
the language switcher
the link produced
https://test.ddev.site/language/en/test-en
https://test.ddev.site/language/it/test-en
i think that the links need to be
https://test.ddev.site/test-en
https://test.ddev.site/test-it
5 replies
Concatenate 2 fields in infoList
Need to formatStateUsing of a textEntry in my infolist by concatenate his value + the value of another field
but i get this error
Non-static method App\Enums\PaymentStatus::getLabel() cannot be called statically
2 replies
Best Practices for Websites with FilamentPHP
Now that I understand how to use FilamentPHP for creating apps and backends, I need to create the frontend. I would use Filament as if it were a CMS. The typical website has static content pages, a blog or news section, plus some custom content. Developing this part shouldn't be a problem.
As for the frontend, I would use the TALL stack, and this shouldn't be an issue either.
However, I'm wondering how to implement the following:
Content visible to everyone and restricted content (should I create a panel for users?)
Menus: how do you manage menus that have links to pages which can be created by users?
I've never done frontend with Laravel, but it seems that working with routes and views is sufficient.
Can you give me some advice?
12 replies
translate notifications
i send notification to user with this code
app language is italian
user language is english, his ui is all translated in english but notification are sent in italian...
if admin UI is set to english, notification are sent in english
any suggestion?
thanks
11 replies
Route and livewire pages display error
In my app i have a page with a livewire component
without a route, i simply call the page /customer/my-repairs
but now i need to add the route in my web.php route file
ListMyRepairs is the livewire component
at the end of the file i call the view
list-my-repairs.blade.php
but i get this error
15 replies
Argument: Web Routes
I'm in the final step of my app, then i would make a proper demo test for you!
I need to tweak the web routes, more in depth
I have 2 panels
- Admin (for admin and technicians)
- Customer (for client)
When i create a customer (and related local user) i send an invitation email with a link to a 'choose your password' form
The same when i create the Technician.
The difference are that customer goes to Customer Panel
and Technician to the Admin Panel
Here i have the first problem, sometimes the customer goes to the admin panel, with error...
Problems is in the route
Which is the best practice for this use case?
2 replies