本文整理汇总了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">
示例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);
}
示例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);
}
示例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");
}
}
示例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');
}
示例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'));
}
}
}
示例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');
}
}