69 lines
1.2 KiB
PHP
69 lines
1.2 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace App\Http\Controllers;
|
||
|
|
||
|
use Illuminate\Http\Request;
|
||
|
use App\Http\Requests\ContentRequest;
|
||
|
use App\Menu;
|
||
|
use App\Content;
|
||
|
use Session;
|
||
|
|
||
|
class ContentController extends MainController
|
||
|
{
|
||
|
|
||
|
public function index()
|
||
|
{
|
||
|
|
||
|
self::$data['content'] = Content::all()->toArray();
|
||
|
// dd(self::$data);
|
||
|
return view('cms.content' , self::$data);
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
public function create()
|
||
|
{
|
||
|
|
||
|
|
||
|
return view('cms.cms-add-content' , self::$data);
|
||
|
}
|
||
|
|
||
|
|
||
|
public function store(ContentRequest $request)
|
||
|
{
|
||
|
|
||
|
Content::save_new($request);
|
||
|
return redirect('cms/content');
|
||
|
}
|
||
|
|
||
|
|
||
|
public function show($id)
|
||
|
{
|
||
|
self::$data['item'] = Content::findThis($id);
|
||
|
return view('cms.delete-contnet' , self::$data);
|
||
|
}
|
||
|
|
||
|
|
||
|
public function edit($id)
|
||
|
{
|
||
|
self::$data['content'] = Content::findThis($id);
|
||
|
return view('cms.edit_content' , self::$data);
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
public function update(ContentRequest $request, $id)
|
||
|
{
|
||
|
Content::update_item($request,$id);
|
||
|
return redirect('cms/content');
|
||
|
}
|
||
|
|
||
|
public function destroy($id)
|
||
|
{
|
||
|
Content::destroy($id);
|
||
|
Session::flash('sm' , 'Content Deleted');
|
||
|
return redirect('cms/content');
|
||
|
}
|
||
|
}
|