getRequest()->serverName ; if($server_name == 'localhost') { return 'http://localhost/reservation_pain/frontend/web/' ; } elseif($server_name == 'www.laboiteapain.net' || $server_name == 'boulanger.laboiteapain.net') { return 'http://www.laboiteapain.net/' ; } elseif($server_name == 'dev.laboiteapain.net' || $server_name == 'boulanger-dev.laboiteapain.net') { return 'http://dev.laboiteapain.net/' ; } elseif($server_name == 'demo.laboiteapain.net' || $server_name == 'boulanger-demo.laboiteapain.net') { return 'http://demo.laboiteapain.net/' ; } } public static function backend() { $server_name = Yii::$app->getRequest()->serverName ; if($server_name == 'localhost') { return 'http://localhost/reservation_pain/backend/web/' ; } elseif($server_name == 'www.laboiteapain.net' || $server_name == 'boulanger.laboiteapain.net') { return 'http://boulanger.laboiteapain.net/' ; } elseif($server_name == 'dev.laboiteapain.net' || $server_name == 'boulanger-dev.laboiteapain.net') { return 'http://boulanger-dev.laboiteapain.net/' ; } elseif($server_name == 'demo.laboiteapain.net' || $server_name == 'boulanger-demo.laboiteapain.net') { return 'http://boulanger-demo.laboiteapain.net/' ; } } public static function env($env, $section) { $server_name = Yii::$app->getRequest()->serverName ; if($section == 'backend') { if($server_name == 'localhost') { return 'http://localhost/reservation_pain/backend/web/' ; } else { if($env == 'prod') { return 'http://boulanger.laboiteapain.net/' ; } else { return 'http://boulanger-'.$env.'.laboiteapain.net/' ; } } } else { if($server_name == 'localhost') { return 'http://localhost/reservation_pain/frontend/web/' ; } else { if($env == 'prod') { return 'http://www.laboiteapain.net/' ; } else { return 'http://'.$env.'.laboiteapain.net/' ; } } } } }