33 lines
624 B
PHP
33 lines
624 B
PHP
<?php
|
|
|
|
namespace App\Presenters;
|
|
|
|
class SiteNamePresenter
|
|
{
|
|
private $siteName;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->siteName = $this->init();
|
|
}
|
|
|
|
public function init()
|
|
{
|
|
$configSiteName = config('app.name', 'Laravel');
|
|
try {
|
|
$optionSiteName = app('Option')->getOption('site_name');
|
|
if(!$optionSiteName) {
|
|
return $configSiteName;
|
|
}
|
|
} catch(\Exception $e) {
|
|
return $configSiteName;
|
|
}
|
|
return $optionSiteName;
|
|
}
|
|
|
|
public function get()
|
|
{
|
|
return $this->siteName;
|
|
}
|
|
}
|