Hi Guys
Just been doing Alexes course on Laravel Booking System now what hes saying is that Money Package is not compatible with L:aravel 11
This one is
Just install as normal as normal
composer require torann/currency
Publish the config file not necessary but advisable
php artisan vendor:publish --provider="Torann\Currency\CurrencyServiceProvider" --tag=config
Laravel 11 has no middleware folder so you can skip the middleware section if your looking at the website its done automatically on install
Publish the migrations
php artisan vendor:publish --provider="Torann\Currency\CurrencyServiceProvider" --tag=migrations
php artisan migrate
php artisan currency:manage <action> <currency>
For example
php artisan currency:manage add 'GBP, EUR'
To get it working
In your model ie Reading or Product Model
public function currency()
{
if(App::isLocale('en'))
{
return currency($this->price, $from = 'GBP', $to = 'GBP', $format = true);
}
if(App::isLocale('eu'))
{
return currency($this->price, $from = 'GBP', $to = 'EUR', $format = true);
}
if(App::isLocale('us'))
{
return currency($this->price, $from = 'GBP', $to = 'USD', $format = true);
}
if(App::isLocale('ca'))
{
return currency($this->price, $from = 'GBP', $to = 'CAD', $format = true);
}
if(App::isLocale('au'))
{
return currency($this->price, $from = 'GBP', $to = 'AUD', $format = true);
}
}
In your blade template
{{ $reading->currency($reading->price) }}
Thats for you alex