Feedback in V3
This commit is contained in:
parent
765d6a2f6b
commit
6e0c7e8706
19 changed files with 1141 additions and 491 deletions
82
app/Http/Controllers/CMSFeedbackController.php
Executable file
82
app/Http/Controllers/CMSFeedbackController.php
Executable file
|
|
@ -0,0 +1,82 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
|
||||
|
||||
use App\Models\Feedback;
|
||||
use Input;
|
||||
|
||||
class CMSFeedbackController extends Controller
|
||||
{
|
||||
|
||||
/*
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the application dashboard.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$data = [
|
||||
'feedbacks' => Feedback::all(),//Feedback::where('lvl', 1)->get(),
|
||||
];
|
||||
return view('cms.feedback.index', $data);
|
||||
|
||||
}
|
||||
|
||||
public function detail($id)
|
||||
{
|
||||
if($id == "new") {
|
||||
$feedback = new Feedback();
|
||||
$id = 'new';
|
||||
|
||||
}else{
|
||||
$feedback = Feedback::findOrFail($id);
|
||||
$id = $feedback->id;
|
||||
}
|
||||
$data = [
|
||||
'feedback' => $feedback,
|
||||
'id' => $id,
|
||||
];
|
||||
return view('cms.feedback.detail', $data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function store($id)
|
||||
{
|
||||
$data = Input::all();
|
||||
if($id == "new") {
|
||||
$feedback = new Feedback();
|
||||
}else{
|
||||
$feedback = Feedback::findOrFail($id);
|
||||
}
|
||||
|
||||
$feedback->title = $data['title'];
|
||||
$feedback->status = isset($data['status']) ? true : false;
|
||||
$feedback->slug = $data['slug'];
|
||||
$feedback->date = $data['date'];
|
||||
$feedback->content = $data['content'];
|
||||
$feedback->description = $data['description'];
|
||||
$feedback->pagetitle = $data['pagetitle'];
|
||||
$feedback->keywords = $data['keywords'];
|
||||
|
||||
//parent
|
||||
$feedback->save();
|
||||
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('cms_feedback_detail', [$feedback->id]));
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue