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


PHP Publisher::find方法代码示例

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


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

示例1:

                <a href="http://www.facebook.com/sharer.php?u={{route('shareLink',array('id' => $cat_name,'data' => $post->link))}}" target="_blank" class="waves-effect waves-light btn light-blue darken-4"><i class="fa fa-facebook left"></i>{{tr('share')}} <span class="hidden-s">{{tr('on_fb')}}</span></a>
                    <a href="http://twitter.com/share?text={{$post->title}}...&url={{route('shareLink',array('id' => $cat_name,'data' => $post->link))}}" target="_blank" class="waves-effect waves-light btn no-right-mar light-blue accent-3"><i class="fa fa-twitter left"></i>{{tr('share')}} <span class="hidden-s">{{tr('on_twitter')}}</span></a>
                    <a href="{{{$post->url}}}" target="_blank" class="waves-effect waves-light btn no-right-mar dark-blue darken">{{tr('read_more')}}</a>
            </div>
            

        </div>

        <div class="clear-both"></div>

        <div class="row single-btm-blk hidden-s">
                @foreach($related as $post)

            <?php 
$cat_name = $post->share_cat;
if ($publisher = Publisher::find($post->publisher_id)) {
    $publisher_image = $publisher->image;
} else {
    $publisher_image = "";
}
?>

                <div class="col m6 s12 l3 single-btm-blk-box">
                  <div class="single-post card animated zoomIn">
                        @if($post->image)
                          <div class="card-image">
                            <a href="javascript:void(0);"><img src="{{$post->image}}"></a>
                            <span class="card-title">{{$post->title}}</span>
                          </div>
                        @endif
                      <div class="card-content">
开发者ID:amrutjadhav,项目名称:Laravel_application,代码行数:31,代码来源:single-post.blade.php

示例2: test_model_update_cache

 public function test_model_update_cache()
 {
     $method = $this->set_method_public('Publisher', 'cache_key');
     $publisher = Publisher::find(1);
     $cache_key = $method->invokeArgs($publisher, array());
     $this->assertEquals("Random House", $publisher->name);
     $publisherDirectlyFromCache = Cache::$adapter->read($cache_key);
     $this->assertEquals("Random House", $publisherDirectlyFromCache->name);
     // make sure that updates make it to cache
     $publisher->name = "Puppy Publishing";
     $publisher->save();
     $publisherDirectlyFromCache = Cache::$adapter->read($cache_key);
     $this->assertEquals("Puppy Publishing", $publisherDirectlyFromCache->name);
 }
开发者ID:nehulyadav,项目名称:php-activerecord,代码行数:14,代码来源:CacheModelTest.php

示例3: singlePost

 public function singlePost()
 {
     $post_id = Input::get('id');
     $validator = Validator::make(array('post_id' => $post_id), array('post_id' => 'required'));
     if ($validator->fails()) {
         $error_messages = $validator->messages()->all();
         $response_array = array('success' => false, 'error' => 'Invalid Input', 'error_code' => 401, 'error_messages' => $error_messages);
         $response_code = 200;
     } else {
         if ($post = Post::find($post_id)) {
             if ($publisher = Publisher::find($post->publisher_id)) {
                 $publisher_name = $publisher->name;
                 $publisher_image = $publisher->image;
             } else {
                 $publisher_name = "";
                 $publisher_image = "";
             }
             $datas = array();
             $cat_name = $post->share_cat;
             $link = URL::to('/') . '/read/' . $cat_name . '/' . $post->link;
             $data = array();
             $data['id'] = $post->id;
             $data['title'] = $post->title;
             $data['description'] = $post->des;
             $data['url'] = $post->url;
             $data['image'] = $post->image;
             $data['time'] = $post->created_at->diffForHumans();
             $data['share_link'] = $link;
             $data['publisher_image'] = $publisher_image;
             $data['publisher_name'] = $publisher_name;
             array_push($datas, $data);
             $response_array = array('success' => true, 'posts' => $datas);
         } else {
             $response_array = array('success' => false, 'error' => 'Post Not Found');
         }
     }
     return Response::json($response_array);
 }
开发者ID:amrutjadhav,项目名称:Laravel_application,代码行数:38,代码来源:ApiController.php

示例4: viewPost

 public function viewPost($id, $data)
 {
     $segment = $data;
     $cats = Category::orderBy('order_type')->get();
     $post_details = Post::where('link', $segment)->where('is_approved', 1)->first();
     $related = Post::orderByRaw("RAND()")->where('is_approved', 1)->take(2)->get();
     if ($post_details) {
         if ($publisher = Publisher::find($post_details->publisher_id)) {
             $publisher_name = $publisher->name;
             $publisher_image = $publisher->image;
         } else {
             $publisher_name = "";
             $publisher_image = "";
         }
         return View::make('single-post')->withRelated($related)->with('publisher_image', $publisher_image)->withPost($post_details)->with('cats', $cats);
     } else {
         return Redirect::back()->with('flash_error', "something went wrong");
     }
 }
开发者ID:amrutjadhav,项目名称:Laravel_application,代码行数:19,代码来源:ContributorController.php

示例5: delPublisher

 public function delPublisher($id)
 {
     $katalog = Katalog::where('publisher', '=', $id)->get();
     foreach ($katalog as $value) {
         $k = Katalog::find($value->id);
         $k->publisher = NULL;
         $k->save();
     }
     $publisher = Publisher::find($id);
     $publisher->delete();
     return Redirect::to('admin/publisher');
 }
开发者ID:beruxganteng,项目名称:repository-djpbn,代码行数:12,代码来源:BackendController.php

示例6: editPublisherProcess

 public function editPublisherProcess($id)
 {
     $name = Input::get('name');
     $cat_img = Input::file('picture');
     $publisher = Publisher::find($id);
     if ($publisher) {
         $publisher->name = $name;
         $validator = Validator::make(array('picture' => $cat_img), array('picture' => 'required|mimes:jpeg,bmp,gif,png'));
         if ($validator->fails()) {
             //do nothing
         } else {
             $file_name = seo_url(Input::get('name')) . '-' . time();
             $ext = Input::file('picture')->getClientOriginalExtension();
             Input::file('picture')->move(public_path() . "/uploads", $file_name . "." . $ext);
             $local_url = $file_name . "." . $ext;
             $s3_url = URL::to('/') . '/uploads/' . $local_url;
             $publisher->image = $s3_url;
         }
         $publisher->save();
         if ($publisher) {
             return Redirect::back()->with('flash_success', tr('publisher_update'));
         } else {
             return Redirect::back()->with('flash_error', tr('went_wrong'));
         }
     }
 }
开发者ID:amrutjadhav,项目名称:Laravel_application,代码行数:26,代码来源:AdminController.php

示例7: shareLink

 public function shareLink($id, $data)
 {
     $segment = $data;
     $cats = Category::orderBy('order_type')->get();
     $post_details = Post::where('link', $segment)->where('is_approved', 1)->first();
     $related = Post::orderByRaw("RAND()")->where('is_approved', 1)->take(2)->get();
     if ($post_details) {
         if ($publisher = Publisher::find($post_details->publisher_id)) {
             $publisher_name = $publisher->name;
             $publisher_image = $publisher->image;
         } else {
             $publisher_name = "";
             $publisher_image = "";
         }
         counter($segment);
         return View::make('single-post')->withRelated($related)->with('publisher_image', $publisher_image)->withPost($post_details)->with('cats', $cats);
     } else {
         return Redirect::route('home');
     }
 }
开发者ID:amrutjadhav,项目名称:Laravel_application,代码行数:20,代码来源:HomeController.php


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