2016-12-08 21:37:07 +02:00

106 lines
2.5 KiB
Plaintext
Executable File

<?php
namespace $CLASS_NAMESPACE$;
use Auth;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Routing\Controller;
use App\Http\Controllers\BaseController;
use App\Services\DatatableService;
use Modules\$STUDLY_NAME$\Repositories\$STUDLY_NAME$Repository;
use Modules\$STUDLY_NAME$\Datatables\$STUDLY_NAME$Datatable;
class $CLASS$ extends BaseController
{
protected $$STUDLY_NAME$Repo;
//protected $entityType = '$LOWER_NAME$';
public function __construct($STUDLY_NAME$Repository $$LOWER_NAME$Repo)
{
//parent::__construct();
$this->$LOWER_NAME$Repo = $$LOWER_NAME$Repo;
}
/**
* Display a listing of the resource.
* @return Response
*/
public function index()
{
return view('list_wrapper', [
'entityType' => '$LOWER_NAME$',
'datatable' => new $STUDLY_NAME$Datatable(),
'title' => trans('texts.$LOWER_NAME$'),
]);
}
public function getDatatable(DatatableService $datatableService)
{
$search = request()->input('test');
$userId = Auth::user()->filterId();
$datatable = new $STUDLY_NAME$Datatable();
$query = $this->$LOWER_NAME$Repo->find($search, $userId);
return $datatableService->createDatatable($datatable, $query);
}
/**
* Show the form for creating a new resource.
* @return Response
*/
public function create()
{
$data = [
'$LOWER_NAME$' => null,
'method' => 'POST',
'url' => '$LOWER_NAME$',
'title' => trans('texts.new_$LOWER_NAME$'),
];
return view('$LOWER_NAME$::edit', $data);
}
/**
* Store a newly created resource in storage.
* @param Request $request
* @return Response
*/
public function store(Request $request)
{
$client = $this->$LOWER_NAME$Repo->save($request->input());
Session::flash('message', trans('texts.created_$LOWER_NAME$'));
return redirect()->to($$LOWER_NAME$->getRoute());
}
/**
* Show the form for editing the specified resource.
* @return Response
*/
public function edit()
{
return view('$LOWER_NAME$::edit');
}
/**
* Update the specified resource in storage.
* @param Request $request
* @return Response
*/
public function update(Request $request)
{
}
/**
* Remove the specified resource from storage.
* @return Response
*/
public function destroy()
{
}
}