FileManager
This commit is contained in:
parent
c8948338bb
commit
f1e0900a7a
131 changed files with 5844 additions and 3081 deletions
91
app/Http/Controllers/CMS/CMSContentAuthorController.php
Executable file
91
app/Http/Controllers/CMS/CMSContentAuthorController.php
Executable file
|
|
@ -0,0 +1,91 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\CMS;
|
||||
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\CMSAuthor;
|
||||
use Request;
|
||||
use Validator;
|
||||
|
||||
|
||||
class CMSContentAuthorController extends Controller
|
||||
{
|
||||
|
||||
/*
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public function index()
|
||||
{
|
||||
$data = [
|
||||
'contents' => CMSAuthor::all()->sortByDesc('id')
|
||||
];
|
||||
return view('cms.content.author.index', $data);
|
||||
}
|
||||
|
||||
public function store()
|
||||
{
|
||||
$data = Request::all();
|
||||
$rules = array(
|
||||
'name' => 'required',
|
||||
);
|
||||
$validator = Validator::make(Request::all(), $rules);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return back()->withErrors($validator);
|
||||
}
|
||||
|
||||
if($data['id'] === "new"){
|
||||
CMSAuthor::create($data);
|
||||
}else{
|
||||
|
||||
$model = CMSAuthor::find($data['id']);
|
||||
$model->fill($data);
|
||||
$model->save();
|
||||
}
|
||||
\Session()->flash('alert-save', '1');
|
||||
return redirect(route('cms_content_author'));
|
||||
}
|
||||
|
||||
|
||||
public function loadModal()
|
||||
{
|
||||
if(Request::ajax()){
|
||||
$data = Request::all();
|
||||
$returnHTML = "";
|
||||
if(isset($data['model']) && isset($data['id']) ){
|
||||
if($data['model'] === 'content'){
|
||||
if($data['id'] === "new"){
|
||||
$value = new CMSAuthor();
|
||||
}else {
|
||||
$value = CMSAuthor::find($data['id']);
|
||||
}
|
||||
$returnHTML = view("cms.content.author.modal", compact('data','value') )->render();
|
||||
}
|
||||
|
||||
}
|
||||
return response()->json(['response' => $data, 'html'=>$returnHTML]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function delete($id){
|
||||
$content = CMSAuthor::findOrFail($id);
|
||||
$content->delete();
|
||||
\Session()->flash('alert-success', __('Autor gelöscht'));
|
||||
return redirect(route('cms_content_author'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue