PHP code example of gazugafan / laravel-timezone

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

    

gazugafan / 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');
});