本文整理汇总了PHP中Thread::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Thread::where方法的具体用法?PHP Thread::where怎么用?PHP Thread::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Thread
的用法示例。
在下文中一共展示了Thread::where方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: post_create
public function post_create()
{
$posts = Input::all();
$title = $posts['thread_name'];
$contentRaw = $posts['inputarea'];
if ($title != '' && strlen($contentRaw) > 10) {
$alias = Str::slug($title, '-');
$exist = Thread::where('alias', '=', $alias)->first();
if ($exist != null) {
return Redirect::to($exist->id);
}
$threadData = array('title' => $posts['thread_name'], 'alias' => $alias, 'type' => 0, 'poster_ip' => Request::ip(), 'dateline' => date("Y-m-d H:i:s"), 'last_message_at' => date("Y-m-d H:i:s"));
$thread = Thread::create($threadData);
if ($thread != null) {
$content = static::replace_at(BBCode2Html(strip_tags_attributes($contentRaw)), $thread->id);
$postData = array('thread_id' => $thread->id, 'entry' => $content, 'userip' => Request::ip(), 'user_id' => Sentry::user()->id, 'datetime' => date("Y-m-d H:i:s"), 'count' => 1, 'type' => 0);
$pst = Post::create($postData);
if ($pst != null) {
return Redirect::to($thread->id);
}
}
} else {
return Redirect::to(URL::full());
}
}
示例2: get_thread
public function get_thread()
{
//Array ( [thread] => asdgasyhudjıkopağ )
$inputs = Input::all();
$key = $inputs['term'];
$basliklar = Thread::where('title', 'LIKE', '%' . $key . '%')->order_by('title', 'asc')->take(10)->get(array('id', 'title'));
$titles = array();
foreach ($basliklar as $title) {
$titleX = array('label' => $title->title, 'id' => $title->id);
array_push($titles, $titleX);
}
return Response::json($titles);
}
示例3: showthread
public function showthread($name)
{
$info = HelperFunctions::forum_url_info($name);
if ($info['forum'] == 0) {
return Redirect::to("/dien-dan.html");
}
$threads = Thread::where('forum', $info['forum'])->orderBy('status', 'desc')->orderBy('updated_at', 'desc')->paginate(15);
$view = ForumViewCount::find($info['forum']);
$view->view = $view->view + 1.25;
$view->save();
$data = array('threads' => $threads, 'seo' => $info, 'forums' => HelperFunctions::forum_list(), 'page' => "Forum", 'id' => Session::get('idCok'), 'coin' => Session::get('coinCok'), 'name' => $name);
return View::make('template.neon.thread')->with($data);
}
示例4: showthread
public function showthread($name)
{
$info = HelperFunctions::forum_url_info($name);
if ($info['forum'] == 0) {
return Redirect::to("/dien-dan.html");
}
$threads = Thread::where('forum', $info['forum'])->orderBy('status', 'desc')->orderBy('updated_at', 'desc')->paginate(2);
$view = ForumViewCount::find($info['forum']);
$view->view = $view->view + 1.25;
$view->save();
$seo['page'] = $info['h1'];
$seo['title'] = $info['title'];
$seo['discription'] = 'discription of this page';
$seo['forum'] = $info['forum'];
$data = array('threads' => $threads, 'seo' => $seo, 'forums' => HelperFunctions::forum_list());
return View::make('template.flatkit.thread')->with($data);
}
示例5: post_post
public function post_post()
{
$data = json_decode(Input::get('json'));
$fields = array('post' => $data->inputarea, 'threadid' => $data->thread_id);
if (Sentry::guest()) {
return json_encode(array("success" => 0, "msg" => "üye olda gel"));
}
//filter falan ama sonra ..
$userid = Sentry::user()->id;
$userip = Request::ip();
$cThread = Thread::where('id', '=', $fields['threadid'])->first();
/*FLOOD PROTECTION*/
####################
/*$_messageTime = Post::where(function ($query) use ($cThread,$userid){
$query->where('thread_id','=',$cThread->id);
$query->where('user_id', '=',$userid);
})
->order_by('datetime','DESC')
->first(array('datetime'));
if($_messageTime){
$_timestamp = strtotime($_messageTime->datetime);
$_timeCalc = time()-10;
if($_timestamp >= $_timeCalc)
{
return json_encode(array("success" => 0,"msg" => "Cok hızlı giriyorsun babacan!"));
}
}*/
####################
/*FLOOD PROTECTION*/
// Check user has 10 post if he newbie member
if (Sentry::user()->user_type == 0) {
$fulled = false;
$post = Post::where('user_id', '=', Sentry::user()->id);
if ($post->count() >= 10) {
return json_encode(array("success" => 0, "msg" => "Çaylak Olarak Bu kadar Yazdıgınız Yeter.\nLütfen Bir adminin onaylamasını bekleyiniz."));
}
}
if (Sentry::user()->has_access('can_post') && $cThread->type == 0) {
if (Sentry::user()->user_type == 0) {
$post_type = 0;
} else {
$post_type = 1;
}
if (strlen(trim($fields['post'])) >= 5 || Sentry::user()->has_access('is_mod')) {
$max = Post::where('thread_id', '=', $fields['threadid'])->max('count');
$post = static::replace_at(BBCode2Html(strip_tags_attributes($fields['post'])), $fields['threadid']);
$postData = array('thread_id' => $fields['threadid'], 'entry' => $post, 'userip' => $userip, 'user_id' => $userid, 'datetime' => date("Y-m-d H:i:s"), 'count' => $max + 1, 'type' => $post_type);
/*
Update last message on thread table
*/
$cThread->last_message_at = date("Y-m-d H:i:s");
$cThread->save();
$id = DB::table('posts')->insert_get_id($postData);
$entry = Post::with('author')->where_id($id)->first();
$threadid = $fields['threadid'];
$count = Post::where(function ($query) use($threadid) {
$query->where('thread_id', '=', $threadid);
$query->where('type', '=', 1);
})->count();
// cache deki konuyu okumuş memberlari sil
DB::query('DELETE FROM xr_threadsmembers WHERE thread_id=?', array($threadid));
/*Page Function*/
$pagenum = ceil($count / static::$per_page);
//doing ajax callbacks
//create view
$view = array("id" => $entry->id, "count" => $entry->count, "entry" => $entry->entry, "author" => $entry->author->username, "date" => $entry->datetime, "page" => $pagenum);
return Response::json($view);
} else {
return json_encode(array("success" => 0, "msg" => "entry çok kısa babacan"));
}
} else {
return json_encode(array("success" => 0, "msg" => "yetki yok hocam"));
}
return json_encode(array("success" => 0, "msg" => "Undefined Error!"));
}