PHP code example of fabatek / laravel-timezone

1. Go to this page and download the library: Download fabatek/laravel-timezone 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/ */

    

fabatek / laravel-timezone example snippets


'providers' => [
	...
	\Gazugafan\Timezone\TimezoneServiceProvider::class
];

'aliases' => [
	...
	'Timezone' => Gazugafan\Timezone\Facades\Timezone::class
];
config/app.php
config/app.php
timezone
config/app.php
timezone

Timezone::setCurrentUsersTimezoneFunction(function() {
	if (MyFancyUser()->isLoggedIn())
		return MyFancyUser()->getTheirTimezone();
	else
		return config('app.timezone');
});