创建版本
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
<?php namespace Gdoo\Forum\Controllers;
|
||||
|
||||
use DB;
|
||||
|
||||
use Gdoo\Index\Controllers\DefaultController;
|
||||
|
||||
class CategoryController extends DefaultController
|
||||
{
|
||||
// 论坛类别
|
||||
public function indexAction()
|
||||
{
|
||||
// 更新排序
|
||||
if ($post = $this->post('sort')) {
|
||||
foreach ($post as $k => $v) {
|
||||
$data['sort'] = $v;
|
||||
DB::table('forum')->where('id', $k)->update($data);
|
||||
}
|
||||
}
|
||||
|
||||
$rows = DB::table('forum')
|
||||
->where('state', '1')
|
||||
->get(['id', 'name']);
|
||||
|
||||
if (Request::get('data_type') == 'json') {
|
||||
return $this->json($rows, true);
|
||||
}
|
||||
return $this->display([
|
||||
'rows' => $rows,
|
||||
]);
|
||||
}
|
||||
|
||||
// 论坛列别编辑
|
||||
public function addAction()
|
||||
{
|
||||
$id = (int)Request::get('id');
|
||||
|
||||
if ($post = $this->post()) {
|
||||
if (empty($post['name'])) {
|
||||
return $this->error('类别名称必须填写。');
|
||||
}
|
||||
|
||||
unset($post['past_parent_id']);
|
||||
|
||||
if ($post['id'] > 0) {
|
||||
DB::table('forum')->where('id', $post['id'])->update($post);
|
||||
} else {
|
||||
DB::table('forum')->insert($post);
|
||||
}
|
||||
return $this->success('index', '类别更新成功。');
|
||||
}
|
||||
|
||||
$row = DB::table('forum')->where('id', $id)->first();
|
||||
|
||||
return $this->display(array(
|
||||
'row' => $row,
|
||||
));
|
||||
}
|
||||
|
||||
// 论坛列别删除
|
||||
public function deleteAction()
|
||||
{
|
||||
if ($id = Request::get('id')) {
|
||||
DB::table('forum')->where('id', $id)->delete();
|
||||
DB::table('forum_post')->where('forum_id', $id)->delete();
|
||||
return $this->success('index', '类别删除成功。');
|
||||
}
|
||||
return $this->error('类别删除失败。');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,244 @@
|
||||
<?php namespace Gdoo\Forum\Controllers;
|
||||
|
||||
use DB;
|
||||
use Auth;
|
||||
|
||||
use Gdoo\Forum\Models\Forum;
|
||||
use Gdoo\Forum\Models\ForumPost;
|
||||
use Gdoo\Index\Controllers\DefaultController;
|
||||
|
||||
class PostController extends DefaultController
|
||||
{
|
||||
// 板块列表
|
||||
public function indexAction()
|
||||
{
|
||||
$forum = Forum::where('forum.state', 1);
|
||||
|
||||
// 权限限制
|
||||
$level = authorise('index');
|
||||
|
||||
if ($level < 4) {
|
||||
$forum->permission('forum.scope_id');
|
||||
}
|
||||
|
||||
$forum->selectRaw('forum.*')
|
||||
->groupBy('forum.id');
|
||||
|
||||
$rows = $forum->get();
|
||||
|
||||
foreach ($rows as &$row) {
|
||||
// 板块最后一个帖子
|
||||
$row['post'] = ForumPost::whereRaw('parent_id=0')
|
||||
->where('forum_id', $row['id'])
|
||||
->orderBy('id', 'desc')
|
||||
->first(['id', 'title', 'add_user_id', 'add_time']);
|
||||
|
||||
// 统计板块今天帖子数
|
||||
$row['today'] = ForumPost::whereRaw('parent_id=0')
|
||||
->where('forum_id', $row['id'])
|
||||
->whereRaw('TO_DAYS(FROM_UNIXTIME(add_time)) = TO_DAYS(NOW())')
|
||||
->count('id');
|
||||
}
|
||||
|
||||
return $this->display([
|
||||
'rows' => $rows,
|
||||
]);
|
||||
}
|
||||
|
||||
// 论坛类别帖子列表
|
||||
public function forumAction()
|
||||
{
|
||||
$id = Request::get('id');
|
||||
|
||||
$search = search_form([
|
||||
'id' => $id,
|
||||
'referer' => 1
|
||||
], [
|
||||
['text','title','主题'],
|
||||
]);
|
||||
|
||||
$query = $search['query'];
|
||||
|
||||
$model = ForumPost::whereRaw('parent_id=0 and forum_id=?', [$id])
|
||||
->orderBy('id', 'desc');
|
||||
|
||||
foreach ($search['where'] as $where) {
|
||||
if ($where['active']) {
|
||||
$model->search($where);
|
||||
}
|
||||
}
|
||||
|
||||
$rows = $model->paginate()->appends($query);
|
||||
|
||||
foreach ($rows as $key => $row) {
|
||||
$row->post = ForumPost::where('parent_id', $row->id)
|
||||
->orderBy('id', 'desc')
|
||||
->first();
|
||||
|
||||
$row->count = ForumPost::where('parent_id', $row->id)
|
||||
->count('id');
|
||||
|
||||
$rows->put($key, $row);
|
||||
}
|
||||
|
||||
$today = ForumPost::whereRaw('parent_id=0 and TO_DAYS(FROM_UNIXTIME(add_time))=TO_DAYS(NOW()) and forum_id=?', [$id])->count('id');
|
||||
|
||||
$forum['count'] = $rows->total();
|
||||
$forum['today'] = $today;
|
||||
$forum['id'] = $id;
|
||||
|
||||
return $this->display([
|
||||
'forum' => $forum,
|
||||
'rows' => $rows,
|
||||
'search' => $search,
|
||||
]);
|
||||
}
|
||||
|
||||
public function addAction()
|
||||
{
|
||||
$id = Request::get('id');
|
||||
$forum_id = Request::get('forum_id');
|
||||
|
||||
$row = DB::table('forum_post')->where('id', $id)->first();
|
||||
|
||||
$row['forum_id'] = empty($row['forum_id']) ? $forum_id : $row['forum_id'];
|
||||
|
||||
// 更新数据
|
||||
if ($post = $this->post()) {
|
||||
if (empty($post['title'])) {
|
||||
return $this->error('主题必须填写。');
|
||||
}
|
||||
|
||||
if (empty($post['content'])) {
|
||||
return $this->error('正文必须填写。');
|
||||
}
|
||||
|
||||
$post['content'] = $_POST['content'];
|
||||
$post['attachment'] = join(',', (array)$post['attachment']);
|
||||
|
||||
// 更新数据库
|
||||
if ($post['id'] > 0) {
|
||||
DB::table('forum_post')->where('id', $post['id'])->update($post);
|
||||
} else {
|
||||
$post['add_time'] = time();
|
||||
$post['add_user_id'] = Auth::id();
|
||||
$post['id'] = DB::table('forum_post')->insertGetId($post);
|
||||
}
|
||||
|
||||
// 设置附件为已经使用
|
||||
attachment_store('forum_attachment', $_POST['attachment']);
|
||||
|
||||
return $this->success('view', ['id' => $post['id']], '帖子发表成功。');
|
||||
}
|
||||
|
||||
$attachList = attachment_edit('forum_attachment', $row['attachment'], 'forum');
|
||||
|
||||
return $this->display([
|
||||
'attachList' => $attachList,
|
||||
'row' => $row,
|
||||
]);
|
||||
}
|
||||
|
||||
public function commentAction()
|
||||
{
|
||||
$id = Request::get('id');
|
||||
$parent_id = Request::get('parent_id');
|
||||
|
||||
// 更新数据
|
||||
if ($post = $this->post()) {
|
||||
if (empty($post['content'])) {
|
||||
return $this->error('正文必须填写。');
|
||||
}
|
||||
|
||||
$post['content'] = $_POST['content'];
|
||||
$post['attachment'] = join(',', (array)$post['attachment']);
|
||||
|
||||
// 更新数据库
|
||||
if ($post['id']) {
|
||||
DB::table('forum_post')->where('id', $post['id'])->update($post);
|
||||
} else {
|
||||
$post['add_time'] = time();
|
||||
$post['add_user_id'] = Auth::id();
|
||||
DB::table('forum_post')->insert($post);
|
||||
}
|
||||
|
||||
// 设置附件为已经使用
|
||||
attachment_store('forum_attachment', $_POST['attachment']);
|
||||
return $this->success('view', ['id' => $post['parent_id']], '帖子回复保存成功。');
|
||||
}
|
||||
|
||||
$row = DB::table('forum_post')->where('id', $id)->first();
|
||||
$attachList = attachment_edit('forum_attachment', $row['attachment'], 'forum');
|
||||
|
||||
return $this->display([
|
||||
'attachList' => $attachList,
|
||||
'row' => $row,
|
||||
]);
|
||||
}
|
||||
|
||||
public function viewAction()
|
||||
{
|
||||
$id = (int)Request::get('id');
|
||||
|
||||
// 获取帖子主题
|
||||
$post = ForumPost::find($id);
|
||||
|
||||
// 获取帖子回复
|
||||
$rows = ForumPost::where('parent_id', $id)->get();
|
||||
if ($rows->count()) {
|
||||
foreach ($rows as $key => $row) {
|
||||
$row->attach = attachment_get('forum_attachment', $row['attachment']);
|
||||
$rows->put($key, $row);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($post)) {
|
||||
return $this->error('没有数据。');
|
||||
}
|
||||
|
||||
// 更新点击率
|
||||
$post->increment('hit');
|
||||
|
||||
$attachList = attachment_view('forum_attachment', $post['attachment']);
|
||||
$attachment = attachment_edit('forum_attachment', '', 'forum');
|
||||
|
||||
return $this->display([
|
||||
'attachList' => $attachList,
|
||||
'attachment' => $attachment,
|
||||
'post' => $post,
|
||||
'rows' => $rows,
|
||||
]);
|
||||
}
|
||||
|
||||
public function deleteAction()
|
||||
{
|
||||
$id = (int)Request::get('id');
|
||||
|
||||
$post = ForumPost::where('id', $id)->first();
|
||||
|
||||
if (empty($post)) {
|
||||
return $this->error('帖子不存在。');
|
||||
}
|
||||
|
||||
// 删除帖子附件
|
||||
attachment_delete('forum_attachment', $post['attachment']);
|
||||
|
||||
// 删除帖子
|
||||
$post->delete();
|
||||
|
||||
// 删除的是回复
|
||||
if ($post->parent_id == 0) {
|
||||
// 删除帖子全部回复
|
||||
$rows = ForumPost::where('parent_id', $id)->get();
|
||||
if ($rows->count()) {
|
||||
foreach ($rows as $row) {
|
||||
$row->delete();
|
||||
attachment_delete('forum_attachment', $row['attachment']);
|
||||
}
|
||||
}
|
||||
return $this->success('forum', ['id' => $post->forum_id], '帖子删除成功。');
|
||||
} else {
|
||||
return $this->success('view', ['id' => $post->parent_id], '帖子删除成功。');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php namespace Gdoo\Forum\Models;
|
||||
|
||||
use Gdoo\Index\Models\BaseModel;
|
||||
|
||||
class Forum extends BaseModel
|
||||
{
|
||||
protected $table = 'forum';
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php namespace Gdoo\Forum\Models;
|
||||
|
||||
use Gdoo\Index\Models\BaseModel;
|
||||
|
||||
class ForumPost extends BaseModel
|
||||
{
|
||||
protected $table = 'forum_post';
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
return [
|
||||
"name" => "讨论",
|
||||
"version" => "1.0",
|
||||
"description" => "讨论管理",
|
||||
"controllers" => [
|
||||
"category" => [
|
||||
"name" => "板块",
|
||||
"actions" => [
|
||||
"index" => [
|
||||
"name" => "列表"
|
||||
],
|
||||
"view" => [
|
||||
"name" => "查看"
|
||||
],
|
||||
"add" => [
|
||||
"name" => "新建"
|
||||
],
|
||||
"delete" => [
|
||||
"name" => "删除"
|
||||
]
|
||||
]
|
||||
],
|
||||
"post" => [
|
||||
"name" => "帖子",
|
||||
"actions" => [
|
||||
"index" => [
|
||||
"name" => "列表"
|
||||
],
|
||||
"category" => [
|
||||
"name" => "类别"
|
||||
],
|
||||
"reply" => [
|
||||
"name" => "回复"
|
||||
],
|
||||
"view" => [
|
||||
"name" => "查看"
|
||||
],
|
||||
"add" => [
|
||||
"name" => "新建"
|
||||
],
|
||||
"delete" => [
|
||||
"name" => "删除"
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
@@ -0,0 +1,54 @@
|
||||
<div class="panel">
|
||||
<table class="table table-form">
|
||||
<form method="post" action="{{url()}}" id="myform" name="myform">
|
||||
|
||||
<tr>
|
||||
<td align="right" width="10%">板块名称 <span style="color:red">*</span></td>
|
||||
<td align="left">
|
||||
<input type="text" class="form-control input-sm" name="name" value="{{$row['name']}}" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">访问权限</td>
|
||||
<td>
|
||||
{{App\Support\Dialog::search($row,'id=scope_id&name=scope_name&multi=1')}}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">类别状态</td>
|
||||
<td>
|
||||
<label class="radio-inline"><input type="radio" name="state" value="1" @if($row['id']>0&&$row['state']==1) checked="true" @endif > 启用</label>
|
||||
|
||||
<label class="radio-inline"><input type="radio" name="state" value="0" @if($row['id']>0&&$row['state']==0) checked="true" @endif > 停用</label>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">排序</td>
|
||||
<td align="left">
|
||||
<input type="text" class="form-control input-sm" name="sort" value="{{$row['sort']}}" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right">备注</td>
|
||||
<td align="left">
|
||||
<textarea class="form-control input-sm" rows="3" cols="20" type="text" name="remark" id="remark" />{{$row['remark']}}</textarea>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="right"></td>
|
||||
<td align="left">
|
||||
<input type="hidden" name="id" value="{{$row['id']}}" />
|
||||
<input type="hidden" id="past_parent_id" name="past_parent_id" value="{{$row['parent_id']}}" />
|
||||
<button type="submit" class="btn btn-success"><i class="fa fa-check-circle"></i> 提交</button>
|
||||
<button type="button" onclick="history.back();" class="btn btn-default">返回</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
@@ -0,0 +1,54 @@
|
||||
<div class="panel">
|
||||
|
||||
<div class="wrapper">
|
||||
@if(isset($access['add']))
|
||||
<a href="{{url('add')}}" class="btn btn-sm btn-info"><i class="icon icon-plus"></i> 新建</a>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<form method="post" id="myform" name="myform">
|
||||
|
||||
<div class="table-responsive">
|
||||
|
||||
<table class="table m-b-none b-t table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="left">名称</th>
|
||||
<th align="left">备注</th>
|
||||
<th align="center">排序</th>
|
||||
<th align="center">编号</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@if($rows)
|
||||
@foreach($rows as $v)
|
||||
<tr>
|
||||
<td align="left">{{$v['layer_html']}}{{$v['name']}}</td>
|
||||
<td align="left">{{$v['remark']}}</td>
|
||||
<td align="center">
|
||||
<input type="text" class="form-control input-sort" name="sort[{{$v['id']}}]" value="{{$v['sort']}}" />
|
||||
</td>
|
||||
<td align="center">{{$v['id']}}</td>
|
||||
<td align="center">
|
||||
<a class="option" href="{{url('add')}}?id={{$v['id']}}"> 编辑 </a>
|
||||
<a class="option" onclick="app.confirm('{{url('delete',['id'=>$v['id']])}}','确定要删除吗?');" href="javascript:;">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endif
|
||||
</table>
|
||||
|
||||
<footer class="panel-footer">
|
||||
<div class="row">
|
||||
<div class="col-sm-1 hidden-xs">
|
||||
<button type="submit" class="btn btn-primary btn-sm"><i class="icon icon-sort-by-order"></i> 排序</button>
|
||||
</div>
|
||||
<div class="col-sm-11 text-right text-center-xs">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,28 @@
|
||||
<div class="panel">
|
||||
|
||||
<div class="panel-body">
|
||||
|
||||
<form method="post" action="{{url('add')}}" id="myform" name="myform">
|
||||
|
||||
<div class="form-group">
|
||||
<input type="text" id="title" name="title" value="{{$row['title']}}" class="form-control">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
@include('attachment/add')
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{{ueditor('content', $row['content'])}}
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="hidden" name="id" value="{{$row['id']}}">
|
||||
<input type="hidden" name="forum_id" value="{{$row['forum_id']}}">
|
||||
<button onclick="history.back();" class="btn btn-default">返回</button>
|
||||
<button type="submit" class="btn btn-success"><i class="fa fa-check-circle"></i> 发表</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,22 @@
|
||||
<div class="panel">
|
||||
|
||||
<div class="panel-body">
|
||||
<form method="post" action="{{url('comment')}}" id="myform" name="myform">
|
||||
|
||||
<div class="form-group">
|
||||
@include('attachment/add')
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{{ueditor('content', $row['content'])}}
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="hidden" name="id" value="{{$row['id']}}">
|
||||
<input type="hidden" name="parent_id" value="{{$row['parent_id']}}">
|
||||
<button onclick="history.back();" class="btn btn-default">返回</button>
|
||||
<button type="submit" class="btn btn-success"><i class="fa fa-check-circle"></i> 发表回复</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,68 @@
|
||||
<div class="panel">
|
||||
<div class="panel-heading b-b b-light">
|
||||
|
||||
<form id="search-form" class="form-inline" name="mysearch" action="{{url()}}" method="get">
|
||||
|
||||
<div class="pull-right">
|
||||
主题 <span class="badge">{{$forum['count']}}</span>
|
||||
|
||||
今日 <span class="badge bg-info">{{$forum['today']}}</span>
|
||||
</div>
|
||||
|
||||
<a href="{{url('add',['forum_id'=>$forum['id']])}}" class="btn btn-sm btn-info"><i class="icon icon-plus"></i> 发帖</a>
|
||||
|
||||
@include('searchForm')
|
||||
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
$('#search-form').searchForm({
|
||||
data:{{json_encode($search['forms'])}},
|
||||
init:function(e) {
|
||||
var self = this;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="left">主题 / 最后回复</th>
|
||||
<th align="left" width="160">作者</th>
|
||||
<th align="center" width="160">回复 / 查看</th>
|
||||
<th align="left" width="160">最后回复</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@if($rows)
|
||||
<tbody>
|
||||
@foreach($rows as $row)
|
||||
<tr>
|
||||
<td align="left" class="wrapper-xs">
|
||||
<a class="h5" href="{{url('view',['id' => $row->id])}}">{{$row->title}}</a>
|
||||
<small class="block text-muted"></small>
|
||||
</td>
|
||||
<td align="left">
|
||||
<div>{{get_user($row->add_user_id, 'name')}}</div>
|
||||
<small class="block text-muted">@datetime($row->add_time)</small>
|
||||
</td>
|
||||
<td align="center">
|
||||
<div>{{$row->count}}</div>
|
||||
<small class="block text-muted">{{$row['hit']}}</small>
|
||||
</td>
|
||||
<td align="left">
|
||||
<div>{{get_user($row->post->add_user_id, 'name')}}</div>
|
||||
<small class="block text-muted">@datetime($row->post->add_time)</small>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
@endif
|
||||
</table>
|
||||
|
||||
<div class="panel-footer text-right">
|
||||
{{$rows->render()}}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,30 @@
|
||||
<div class="panel">
|
||||
<h4 class="font-thin padder">板块列表</h4>
|
||||
<ul class="list-group alt">
|
||||
@if($rows)
|
||||
@foreach($rows as $row)
|
||||
<li class="list-group-item">
|
||||
<div class="media">
|
||||
<span class="pull-left">
|
||||
<i class="{{$row->today > 0 ? '': 'text-muted'}} fa fa-2x fa-comments m-r-xs"></i>
|
||||
</span>
|
||||
<div class="pull-right m-t-sm">
|
||||
<span class="badge bg-info">{{$row->count}}</span>
|
||||
</div>
|
||||
<div class="media-heading">
|
||||
<a class="h5" href="{{url('forum',['id'=>$row->id])}}">{{$row->name}}</a>
|
||||
<span class="badge">{{$row->today}}</span>
|
||||
</div>
|
||||
<div class="media-body">
|
||||
<small class="block text-muted">
|
||||
最后由 {{get_user($row['post']['add_user_id'], 'name')}}
|
||||
<span> • <span>
|
||||
{{human_time($row['post']['add_time'])}}
|
||||
</small>
|
||||
</div>
|
||||
</span>
|
||||
</li>
|
||||
@endforeach
|
||||
@endif
|
||||
</ul>
|
||||
</div>
|
||||
@@ -0,0 +1,109 @@
|
||||
<div class="panel">
|
||||
<div class="panel-heading b-b b-light">
|
||||
|
||||
<div class="pull-right">
|
||||
<form id="myform" class="form-inline" name="myform" action="{{url()}}" method="get">
|
||||
回复 <span class="badge bg-info">{{sizeof($rows)}}</span>
|
||||
|
||||
查看 <span class="badge">{{$post->hit}}</span>
|
||||
</form>
|
||||
</div>
|
||||
<div class="h5 text-md">{{$post->title}}</div>
|
||||
</div>
|
||||
|
||||
<div class="wrapper-sx">
|
||||
|
||||
<div class="wrapper-xs padder">
|
||||
@if(Auth::id() == $post->add_user_id || is_admin())
|
||||
<div class="pull-right">
|
||||
<a class="btn btn-xs btn-default" href="{{url('add',['id'=>$post->id])}}">编辑</a>
|
||||
<a class="btn btn-xs btn-default" onclick="app.confirm('{{url('delete',['id'=>$post->id])}}','确定要删除吗?');">删除</a>
|
||||
</div>
|
||||
@endif
|
||||
<small class="text-muted">
|
||||
由 {{get_user($post->add_user_id, 'name')}}
|
||||
|
||||
@datetime($post->add_time)
|
||||
</small>
|
||||
</div>
|
||||
|
||||
<div class="wrapper-xs padder">
|
||||
{{$post->content}}
|
||||
|
||||
@if($attachList['view'])
|
||||
<div class="b-a b-light wrapper-sm">
|
||||
@include('attachment/view')
|
||||
</div>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if($rows)
|
||||
<div class="panel">
|
||||
|
||||
<div class="panel-heading">
|
||||
<div class="h5">回复列表</div>
|
||||
</div>
|
||||
|
||||
<div class="wrapper-sx">
|
||||
|
||||
@foreach($rows as $row)
|
||||
|
||||
<div class="wrapper-xs padder b-t">
|
||||
@if(Auth::id() == $row->add_user_id || is_admin())
|
||||
<div class="pull-right">
|
||||
<a class="btn btn-xs btn-default" href="{{url('comment',['id'=>$row->id])}}">编辑</a>
|
||||
<a class="btn btn-xs btn-default" onclick="app.confirm('{{url('delete',['id'=>$row->id])}}','确定要删除吗?');" href="javascript:;">删除</a>
|
||||
</div>
|
||||
@endif
|
||||
<small class="text-muted">
|
||||
由 {{get_user($row->add_user_id, 'name')}}
|
||||
|
||||
@datetime($row->add_time)
|
||||
</small>
|
||||
</div>
|
||||
|
||||
<div class="wrapper-xs padder">
|
||||
|
||||
{{$row->content}}
|
||||
|
||||
@if($row['attach'])
|
||||
<div class="b-a b-light wrapper-sm">
|
||||
{{'';$attachList['view'] = $row['attach']}}
|
||||
@include('attachment/view')
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="panel panel-info">
|
||||
|
||||
<div class="panel-heading">
|
||||
<div class="h5">发表回复</div>
|
||||
</div>
|
||||
|
||||
<div class="padder m-t">
|
||||
<form method="post" action="{{url('comment')}}" id="myform" name="myform">
|
||||
|
||||
<div class="form-group">
|
||||
{{'';$attachList = $attachment}}
|
||||
@include('attachment/add')
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
{{ueditor('content')}}
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<input type="hidden" name="parent_id" value="{{$post->id}}">
|
||||
<a href="{{url('forum',['id'=>$post->forum_id])}}" class="btn btn-default">返回</a>
|
||||
<button type="submit" class="btn btn-success"><i class="fa fa-check-circle"></i> 发表回复</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,5 @@
|
||||
<div class="input-group">
|
||||
<span class="input-group-addon bg-white">主题</span>
|
||||
<input type="text" name="title" class="form-control input-sm" id="title" value="{{$query['title']}}">
|
||||
<input type="hidden" name="id" value="{{$forum['id']}}">
|
||||
</div>
|
||||
Reference in New Issue
Block a user