</td>
						<td>
							<a href="/forums/{{$topic->forum->id}}">{{$topic->forum->name}}</a>
						</td>
						<td>
							{{$topic->firstPost->poster->username}}
						</td>
					</tr>
				@endforeach
			</tbody>
		</table>
	</div>
	<div class="small-12 medium-5 columns">
		<h4>Unresolved Forum Issues</h4>
		<?php 
$topics = ForumTopic::where('is_complete', 0)->where(['forum_id' => 35, 'is_complete' => false, 'is_sticky' => false])->orderBy('created_at')->get();
?>
		<p>
			There are currently <b>{{$topics->count()}}</b> unresolved issues.
			@if($topics->count() > 0) 
				The oldest issue was created <b>{{$topics[0]->created_at->diffForHumans()}}</b>.
			@endif
		</p>
		<table class="responsive">
			<thead>
				<th></th>
				<th>Title</th>
				<th style="width: 20%">Age</th>
			</thead>
			<tbody>
				@foreach($topics as $topic)
示例#2
0
 function deletePost()
 {
     $post = ForumPost::find(Input::get("id"));
     if ($post) {
         $user = Auth::user();
         if ($post->poster->id == $user->id || $user->isStoryteller()) {
             $post_forum = $post->topic->forum;
             $post_topic = $post->topic;
             $post->delete();
             //If this post is the first post in a thread, delete the thread.
             ForumTopic::where('first_post', $post->id)->delete();
             //Redirect to the thread if it still exists. Otherwise, go back to the forum.
             if (ForumTopic::where('id', $post_topic->id)->count() > 0) {
                 return Redirect::to("/forums/topic/" . $post_topic->id);
             } else {
                 return Redirect::to("/forums/" . $post_forum->id);
             }
         } else {
             return Response::json(["success" => false, "message" => "Insufficient privileges."]);
         }
     } else {
         return Response::json(["success" => false, "message" => "No post found with that ID."]);
     }
 }