comments
This commit is contained in:
46
app/Http/Controllers/Admin/Core/CommentController.php
Normal file
46
app/Http/Controllers/Admin/Core/CommentController.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Admin\Core;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use App\Repositories\Core\Comments;
|
||||
use App\Datatables\Admin\Core\CommentsDataTable;
|
||||
|
||||
class CommentController extends Controller
|
||||
{
|
||||
public function index(CommentsDataTable $dataTable, $model, $model_id)
|
||||
{
|
||||
$data['model'] = $model;
|
||||
$data['model_id'] = $model_id;
|
||||
return $dataTable->render('Admin.Core.Comment.index', $data);
|
||||
}
|
||||
|
||||
public function create($model, $model_id)
|
||||
{
|
||||
$data['comment']['commentable_type'] = $model;
|
||||
$data['comment']['commentable_id'] = $model_id;
|
||||
return view('Admin.Core.Comments.partials.modal', $data);
|
||||
}
|
||||
|
||||
public function edit(Request $request, $id = false)
|
||||
{
|
||||
$id = $id ? $id : $request->input('id');
|
||||
$data = Comments::get($id);
|
||||
return view('Admin.Core.Comments.partials.modal', $data);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$data = $request->all();
|
||||
Comments::store($data);
|
||||
return response()->json(['error' => 0]);
|
||||
}
|
||||
|
||||
public function destroy(Request $request, $id = false)
|
||||
{
|
||||
$id = $id ? $id : $request->input('id');
|
||||
Comments::destroy($id);
|
||||
return response()->json(['error' => 0]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user