1. Go to this page and download the library: Download gnireeg/laravel-timezoned library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
gnireeg / laravel-timezoned example snippets
use Gnireeg\LaravelTimezoned\HasTimezoneConversion;
class Event extends Model
{
use HasTimezoneConversion;
protected array $timezonedAttributes = ['starts_at', 'ends_at'];
}
// Automatically converted to user's timezone
$event->starts_at; // Returns Carbon in user's timezone