setHomeInstanceId() публичный Метод

setHomeInstanceId
public setHomeInstanceId ( string $instanceId, null | string $siteKey = null ) : string
$instanceId string menu item instance id
$siteKey null | string site key
Результат string
Пример #1
0
 public function updateSetting(SiteHandler $siteHandler, ThemeHandler $themeHandler, Request $request)
 {
     $newConfig = $request->only(['site_title', 'favicon']);
     $oldConfig = $siteHandler->getSiteConfig();
     /* resolve site_title */
     $oldConfig['site_title'] = $newConfig['site_title'];
     /* resolve favicon */
     $uploaded = array_get($newConfig, 'favicon');
     if ($uploaded !== null) {
         // remove old favicon file
         if ($oldId = $oldConfig->get('favicon.id')) {
             $oldId = $oldConfig->get('favicon.id');
             if ($oldId !== null) {
                 $oldFile = File::find($oldId);
                 if ($oldFile !== null) {
                     app('xe.storage')->remove($oldFile);
                 }
             }
         }
         $saved = app('xe.storage')->upload($uploaded, 'filebox');
         $favicon = ['id' => $saved->id, 'filename' => $saved->clientname];
         $media = app('xe.media');
         $mediaFile = null;
         if ($media->is($saved)) {
             $mediaFile = $media->make($saved);
             $favicon['path'] = $mediaFile->url();
         }
         $oldConfig['favicon'] = $favicon;
     }
     $siteHandler->putSiteConfig($oldConfig);
     // resolve index instance
     $indexInstance = $request->get('indexInstance');
     $siteHandler->setHomeInstanceId($indexInstance);
     return \Redirect::back()->with('alert', ['type' => 'success', 'message' => '저장되었습니다.']);
 }
Пример #2
0
 /**
  * setHome
  *
  * @param SiteHandler $siteHandler site handler
  *
  * @return RendererInterface
  *
  */
 public function setHome(SiteHandler $siteHandler)
 {
     $itemId = Input::get('itemId');
     $siteHandler->setHomeInstanceId($itemId);
     return XePresenter::makeApi([$itemId]);
 }