70 lines
1.8 KiB
PHP
70 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Administracao;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Services\Administracao\NotificacaoService;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Http\Response;
|
|
|
|
class NotificacaoController extends Controller
|
|
{
|
|
protected $modulo = 'administracao';
|
|
protected $funcionalidade = 'notificacao';
|
|
|
|
public function index()
|
|
{
|
|
return response()->json(NotificacaoService::index(), Response::HTTP_OK);
|
|
}
|
|
|
|
public function create()
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(NotificacaoService::create(), Response::HTTP_OK);
|
|
}
|
|
|
|
public function store(Request $request)
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(NotificacaoService::store($request), Response::HTTP_CREATED);
|
|
}
|
|
|
|
public function edit($id)
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(NotificacaoService::edit($id), Response::HTTP_OK);
|
|
}
|
|
|
|
public function update(Request $request, $id)
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(NotificacaoService::update($request, $id), Response::HTTP_OK);
|
|
}
|
|
|
|
public function destroy($id)
|
|
{
|
|
$this->auth(__FUNCTION__);
|
|
|
|
return response()->json(NotificacaoService::destroy($id), Response::HTTP_NO_CONTENT);
|
|
}
|
|
|
|
public function datatable()
|
|
{
|
|
return datatables()
|
|
->of(NotificacaoService::datatable())
|
|
->filterColumn('administracao_notificacao.updated_at', function ($query, $keyword) {
|
|
$query->whereRaw("DATE_FORMAT(administracao_notificacao.updated_at, '%d/%m/%Y %H:%i') like ?", ["%{$keyword}%"]);
|
|
})
|
|
->make(true);
|
|
}
|
|
|
|
public function list()
|
|
{
|
|
return response()->json(NotificacaoService::list(), Response::HTTP_OK);
|
|
}
|
|
}
|