当前位置: 首页>>代码示例>>PHP>>正文


PHP Config::findByKey方法代码示例

本文整理汇总了PHP中app\Config::findByKey方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::findByKey方法的具体用法?PHP Config::findByKey怎么用?PHP Config::findByKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Config的用法示例。


在下文中一共展示了Config::findByKey方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setMetadata

 /**
  * setMetadata for common pages
  */
 private function setMetadata($prefix = '')
 {
     // metadata
     $site_title = Config::findByKey('site_title')->first()->value;
     if ($prefix != '') {
         $site_title = $prefix . ' - ' . $site_title;
     }
     $meta_description = Config::findByKey('meta_description')->first()->value;
     $meta_keywords = Config::findByKey('meta_keywords')->first()->value;
     SEOMeta::setTitle($site_title);
     SEOMeta::setDescription($meta_description);
     SEOMeta::addKeyword([$meta_keywords]);
     OpenGraph::setTitle($site_title);
     OpenGraph::setDescription($meta_description);
     OpenGraph::setUrl(url());
     OpenGraph::addProperty('type', 'website');
     OpenGraph::addProperty('site_name', 'Kết Nối Mới');
     OpenGraph::addImage(url() . '/frontend/images/fb_share_1.jpg');
     OpenGraph::addImage(url() . '/frontend/images/fb_share_2.jpg');
     OpenGraph::addImage(url() . '/frontend/images/fb_share_3.jpg');
     OpenGraph::addImage(url() . '/frontend/images/fb_share_4.jpg');
     OpenGraph::addImage(url() . '/frontend/images/fb_share_5.jpg');
     OpenGraph::addImage(url() . '/frontend/images/fb_share_6.jpg');
     OpenGraph::addImage(url() . '/frontend/images/fb_share_7.jpg');
     // end metadata
 }
开发者ID:phantsang,项目名称:KPh0f834yaAzxwRam833wiFL6,代码行数:29,代码来源:PagesController.php

示例2: getJSONLD

    public function getJSONLD()
    {
        return '{
			"@context": "http://schema.org",
			"@type": "NewsArticle",
			"mainEntityOfPage":{
				"@type":"WebPage",
				"@id":"' . $this->getLink($this->categories()->first()->key) . '"
			},
			"headline": "' . $this->name . '",
			"image": {
				"@type": "ImageObject",
				"url": "' . url() . Image::url($this->getFirstAttachment(), 748, 388, array('crop')) . '",
				"height": "748",
				"width": "388"
			},
			"datePublished": "' . $this->created_at->toW3CString() . '",
			"dateModified": "' . $this->updated_at->toW3CString() . '",
			"author": {
				"@type": "Person",
				"name": "' . $this->created_by . '"
			},
			"publisher": {
				"@type": "Organization",
				"name": "' . Config::findByKey('site_name')->first()->value . '",
				"logo": {
					"@type": "ImageObject",
					"url": "' . url() . '/frontend/images/logo.png",
					"width": "90",
					"height": "21"
    			}
			},
			"description": "' . $this->summary . '"
		}';
    }
开发者ID:phantsang,项目名称:8csfOIjOaJSlDG2Y3x992O,代码行数:35,代码来源:Article.php

示例3: setMetadataByCategory

 private function setMetadataByCategory($category)
 {
     // metadata
     if ($category != null) {
         // metadata
         $site_title = $category->name . ' - ' . Config::findByKey('site_title')->first()->value;
         SEOMeta::setTitle($site_title);
         SEOMeta::setDescription($category->meta_description);
         SEOMeta::addKeyword([$category->meta_keywords]);
         SEOMeta::addMeta('category:published_time', $category->created_at->toW3CString(), 'property');
         SEOMeta::setTitle($category->name . ' - ' . Config::findByKey('site_title')->first()->value);
         SEOMeta::addMeta('category:section', $category->name, 'property');
         OpenGraph::setTitle($site_title);
         OpenGraph::setDescription($category->meta_description);
         //OpenGraph::setUrl(route('category', ['categorykey' => $categorykey]));
         OpenGraph::addProperty('type', 'category');
         OpenGraph::addProperty('locale', app()->getLocale());
         OpenGraph::addProperty('locale:alternate', ['vi-vn', 'en-us']);
         OpenGraph::addImage($category->getFirstAttachment());
         OpenGraph::addImage($category->attachments->lists('path'));
         OpenGraph::addImage(['url' => Image::url($category->getFirstAttachment(), 300, 300, array('crop')), 'size' => 300]);
         // end metadata
     }
 }
开发者ID:phantsang,项目名称:1LGa1Q0ZKAsLRJl29Klz60,代码行数:24,代码来源:PagesController.php

示例4: setMetadata

 /**
  * setMetadata for common pages
  */
 private function setMetadata($prefix = '')
 {
     // metadata
     $site_title = Config::findByKey('site_title')->first()->value;
     if ($prefix != '') {
         $site_title = $prefix . ' - ' . $site_title;
     }
     $meta_description = Config::findByKey('meta_description')->first()->value;
     $meta_keywords = Config::findByKey('meta_keywords')->first()->value;
     SEOMeta::setTitle($site_title);
     SEOMeta::setDescription($meta_description);
     SEOMeta::addKeyword([$meta_keywords]);
     OpenGraph::setTitle($site_title);
     OpenGraph::setDescription($meta_description);
     OpenGraph::setUrl(route('homepage'));
     OpenGraph::addProperty('type', 'articles');
     // end metadata
 }
开发者ID:phantsang,项目名称:M62mPuixxb9vGyP0BuLp274k,代码行数:21,代码来源:SiteControllers.php

示例5: product

 public function product($districtkey, $productkey)
 {
     $product = Product::where('key', $productkey)->first();
     if ($product != null) {
         $other_products = Product::where('active', 1)->orderBy('priority')->take(5)->get();
         // metadata
         $site_title = $product->name . ' - ' . Config::findByKey('site_title')->first()->value;
         SEOMeta::setTitle($site_title);
         SEOMeta::setDescription($product->meta_description);
         SEOMeta::addKeyword([$product->meta_keywords]);
         SEOMeta::addMeta('product:published_time', $product->created_at->toW3CString(), 'property');
         if (isset($product->product_type->name)) {
             SEOMeta::addMeta('product:section', $product->product_type->name, 'property');
         }
         OpenGraph::setTitle($site_title);
         OpenGraph::setDescription($product->meta_description);
         OpenGraph::setUrl($productgetLink());
         OpenGraph::addProperty('type', 'product');
         OpenGraph::addProperty('locale', app()->getLocale());
         OpenGraph::addProperty('locale:alternate', ['vi-vn', 'en-us']);
         OpenGraph::addImage($product->getThumnail());
         OpenGraph::addImage($product->attachments->lists('path'));
         OpenGraph::addImage(['url' => Image::url($product->getThumnail(), 300, 300, array('crop')), 'size' => 300]);
         // end metadata
         return view('frontend.sites.product', compact('product'));
     } else {
         return view('errors.404');
     }
 }
开发者ID:vankhoektcn,项目名称:Qqsipe2UY67gLO7BWrou,代码行数:29,代码来源:SiteProjectcontrollers_.php

示例6: article_detail

    /**
     * ARTICLE_DETAIL
     */
    public function article_detail($article_id, $article_key)
    {
        $article = Article::findOrFail($article_id);
        if ($article != null) {
            // metadata
            $site_title = $article->name . ' - ' . Config::findByKey('site_title')->first()->value;
            SEOMeta::setTitle($site_title);
            SEOMeta::setDescription($article->meta_description);
            SEOMeta::addKeyword([$article->meta_keywords]);
            SEOMeta::addMeta('article:published_time', $article->created_at->toW3CString(), 'property');
            if (isset($article->article_category->name)) {
                SEOMeta::addMeta('article:section', $article->article_category->name, 'property');
            }
            OpenGraph::setTitle($site_title);
            OpenGraph::setDescription($article->meta_description);
            OpenGraph::setUrl($article->getLink());
            OpenGraph::addProperty('type', 'article');
            OpenGraph::addProperty('locale', app()->getLocale());
            OpenGraph::addProperty('locale:alternate', ['vi-vn', 'en-us']);
            OpenGraph::addImage($article->getThumnail());
            OpenGraph::addImage($article->attachments->lists('path'));
            OpenGraph::addImage(['url' => Image::url($article->getThumnail(), 300, 300, array('crop')), 'size' => 300]);
            // end metadata
            $attachments = $article->attachments()->take(5)->get();
            $article_category = $article->categories()->first();
            $article_categorys = isset($article_category) ? ArticleCategory::where('id', '<>', $article_category->id)->where('is_publish', 1)->orderBy('priority')->orderBy('created_at', 'desc')->get() : ArticleCategory::where('is_publish', 1)->orderBy('priority')->orderBy('created_at', 'desc')->get();
            $link = $article->getLink();
            $categoryLink = isset($article_category) ? '<li class="active"><a href="' . $article_category->getLink() . '">' . $article_category->name . '</a></li> ' : '';
            $breadcrumb = '<ul class="breadcrumb pull-left padl0"> 
			<li class="active"><a href="' . route('homepage') . '">Trang chủ</a></li> 
			<li class="active"><a href="' . route('articles') . '">Tin tức</a></li> 
			' . $categoryLink . '
			<li class=""><a href="' . $link . '">' . $article->name . '</a></li>
			</ul>';
            return view('frontend.sites1.article_detail', ['article' => $article, 'attachments' => $attachments, 'article_category' => $article_category, 'article_categorys' => $article_categorys, 'search_type' => 'article_detail', 'link' => $link, 'breadcrumb' => $breadcrumb]);
        } else {
            return view('frontend.sites1.article_detail');
        }
    }
开发者ID:vankhoektcn,项目名称:Qqsipe2UY67gLO7BWrou,代码行数:42,代码来源:SiteControllers.php

示例7: article__

 public function article__($categorykey, $articlekey)
 {
     $article = Article::where('key', $articlekey)->first();
     if ($article != null) {
         // metadata
         $site_title = $article->name . ' - ' . Config::findByKey('site_title')->first()->value;
         SEOMeta::setTitle($site_title);
         SEOMeta::setDescription($article->meta_description);
         SEOMeta::addKeyword([$article->meta_keywords]);
         SEOMeta::addMeta('article:published_time', $article->created_at->toW3CString(), 'property');
         if (isset($article->categories->first()->name)) {
             SEOMeta::addMeta('article:section', $article->categories->first()->name, 'property');
         }
         OpenGraph::setTitle($site_title);
         OpenGraph::setDescription($article->meta_description);
         OpenGraph::setUrl(route('article', ['categorykey' => $categorykey, 'articlekey' => $articlekey]));
         OpenGraph::addProperty('type', 'article');
         OpenGraph::addProperty('locale', app()->getLocale());
         OpenGraph::addProperty('locale:alternate', ['vi-vn', 'en-us']);
         OpenGraph::addImage($article->getFirstAttachment());
         OpenGraph::addImage($article->attachments->lists('path'));
         OpenGraph::addImage(['url' => Image::url($article->getFirstAttachment(), 300, 300, array('crop')), 'size' => 300]);
         // end metadata
         return view('frontend.sites.article', compact('article'));
     } else {
         return view('errors.404');
     }
 }
开发者ID:leloulight,项目名称:Qqsipe2UY67gLO7BWrou,代码行数:28,代码来源:SiteControllers.php

示例8: setMetadata

 /**
  * setMetadata for common pages
  */
 private function setMetadata($prefix = '', $route = 'homepage')
 {
     // metadata
     $site_name = Config::findByKey('site_name')->first()->value;
     $site_title = Config::findByKey('site_title')->first()->value;
     if ($prefix != '') {
         $site_title = $prefix . ' - ' . $site_title;
     }
     $meta_description = Config::findByKey('meta_description')->first()->value;
     $meta_keywords = Config::findByKey('meta_keywords')->first()->value;
     SEOMeta::setTitle($site_title);
     SEOMeta::setDescription($meta_description);
     SEOMeta::setKeywords([$meta_keywords]);
     SEOMeta::addMeta('copyright', $site_name);
     SEOMeta::addMeta('author', $site_name);
     SEOMeta::addMeta('robots', 'all');
     SEOMeta::addMeta('revisit-after', '1 days');
     SEOMeta::addAlternateLanguage('vi-vn', route($route));
     SEOMeta::addAlternateLanguage('en-us', route($route));
     OpenGraph::setTitle($site_title);
     OpenGraph::setDescription($meta_description);
     OpenGraph::setUrl(route($route));
     OpenGraph::setSiteName($site_name);
     OpenGraph::addProperty('type', 'website');
     $social_banner = NavigationCategory::findByKey('banner-social')->first()->navigations()->where('is_publish', 1)->orderBy('priority')->take(5)->get();
     foreach ($social_banner as $key => $banner) {
         OpenGraph::addImage(url() . $banner->getFirstAttachment());
     }
     OpenGraph::addProperty('image:width', 1200);
     OpenGraph::addProperty('image:height', 630);
     // end metadata
 }
开发者ID:phantsang,项目名称:8csfOIjOaJSlDG2Y3x992O,代码行数:35,代码来源:PagesController.php


注:本文中的app\Config::findByKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。