Rearrange main controller create/update commands
This commit is contained in:
parent
cb410f739d
commit
1b20f49f9d
6 changed files with 30 additions and 30 deletions
|
@ -85,13 +85,13 @@ class Appointments extends EA_Controller {
|
|||
{
|
||||
try
|
||||
{
|
||||
$appointment = json_decode(request('appointment'), TRUE);
|
||||
|
||||
if (cannot('add', PRIV_APPOINTMENTS))
|
||||
{
|
||||
abort(403, 'Forbidden');
|
||||
}
|
||||
|
||||
$appointment = json_decode(request('appointment'), TRUE);
|
||||
|
||||
$this->appointments_model->only($appointment, [
|
||||
'start_datetime',
|
||||
'end_datetime',
|
||||
|
@ -124,13 +124,13 @@ class Appointments extends EA_Controller {
|
|||
{
|
||||
try
|
||||
{
|
||||
$appointment = json_decode(request('appointment'), TRUE);
|
||||
|
||||
if (cannot('edit', PRIV_APPOINTMENTS))
|
||||
{
|
||||
abort(403, 'Forbidden');
|
||||
}
|
||||
|
||||
$appointment = json_decode(request('appointment'), TRUE);
|
||||
|
||||
$this->appointments_model->only($appointment, [
|
||||
'id',
|
||||
'start_datetime',
|
||||
|
|
|
@ -159,13 +159,13 @@ class Customers extends EA_Controller {
|
|||
{
|
||||
try
|
||||
{
|
||||
$customer = request('customer');
|
||||
|
||||
if (cannot('add', PRIV_USERS))
|
||||
{
|
||||
abort(403, 'Forbidden');
|
||||
}
|
||||
|
||||
$customer = request('customer');
|
||||
|
||||
$customer_id = $this->customers_model->save($customer);
|
||||
|
||||
json_response([
|
||||
|
@ -186,13 +186,13 @@ class Customers extends EA_Controller {
|
|||
{
|
||||
try
|
||||
{
|
||||
$customer = request('customer');
|
||||
|
||||
if (cannot('edit', PRIV_USERS))
|
||||
{
|
||||
abort(403, 'Forbidden');
|
||||
}
|
||||
|
||||
$customer = request('customer');
|
||||
|
||||
$customer_id = $this->customers_model->save($customer);
|
||||
|
||||
json_response([
|
||||
|
|
|
@ -128,13 +128,13 @@ class Providers extends EA_Controller {
|
|||
{
|
||||
try
|
||||
{
|
||||
$provider = request('provider');
|
||||
|
||||
if (cannot('add', PRIV_USERS))
|
||||
{
|
||||
abort(403, 'Forbidden');
|
||||
}
|
||||
|
||||
$provider = request('provider');
|
||||
|
||||
$provider_id = $this->providers_model->save($provider);
|
||||
|
||||
json_response([
|
||||
|
@ -155,13 +155,13 @@ class Providers extends EA_Controller {
|
|||
{
|
||||
try
|
||||
{
|
||||
$provider = request('provider');
|
||||
|
||||
if (cannot('edit', PRIV_USERS))
|
||||
{
|
||||
abort(403, 'Forbidden');
|
||||
}
|
||||
|
||||
$provider = request('provider');
|
||||
|
||||
$provider_id = $this->providers_model->save($provider);
|
||||
|
||||
json_response([
|
||||
|
|
|
@ -128,13 +128,13 @@ class Secretaries extends EA_Controller {
|
|||
{
|
||||
try
|
||||
{
|
||||
$secretary = request('secretary');
|
||||
|
||||
if (cannot('add', PRIV_USERS))
|
||||
{
|
||||
abort(403, 'Forbidden');
|
||||
}
|
||||
|
||||
$secretary = request('secretary');
|
||||
|
||||
$secretary_id = $this->secretaries_model->save($secretary);
|
||||
|
||||
json_response([
|
||||
|
@ -155,13 +155,13 @@ class Secretaries extends EA_Controller {
|
|||
{
|
||||
try
|
||||
{
|
||||
$secretary = request('secretary');
|
||||
|
||||
if (cannot('edit', PRIV_USERS))
|
||||
{
|
||||
abort(403, 'Forbidden');
|
||||
}
|
||||
|
||||
$secretary = request('secretary');
|
||||
|
||||
$secretary_id = $this->secretaries_model->save($secretary);
|
||||
|
||||
json_response([
|
||||
|
|
|
@ -113,15 +113,15 @@ class Services extends EA_Controller {
|
|||
{
|
||||
try
|
||||
{
|
||||
$service = request('service');
|
||||
|
||||
$service['id_categories'] = $service['id_categories'] ?: null;
|
||||
|
||||
if (cannot('add', PRIV_SERVICES))
|
||||
{
|
||||
abort(403, 'Forbidden');
|
||||
}
|
||||
|
||||
$service = request('service');
|
||||
|
||||
$service['id_categories'] = $service['id_categories'] ?: null;
|
||||
|
||||
$service_id = $this->services_model->save($service);
|
||||
|
||||
json_response([
|
||||
|
@ -142,15 +142,15 @@ class Services extends EA_Controller {
|
|||
{
|
||||
try
|
||||
{
|
||||
$service = request('service');
|
||||
|
||||
$service['id_categories'] = $service['id_categories'] ?: null;
|
||||
|
||||
if (cannot('edit', PRIV_SERVICES))
|
||||
{
|
||||
abort(403, 'Forbidden');
|
||||
}
|
||||
|
||||
$service = request('service');
|
||||
|
||||
$service['id_categories'] = $service['id_categories'] ?: null;
|
||||
|
||||
$service_id = $this->services_model->save($service);
|
||||
|
||||
json_response([
|
||||
|
|
|
@ -70,13 +70,13 @@ class Unavailabilities extends EA_Controller {
|
|||
{
|
||||
try
|
||||
{
|
||||
$unavailability = json_decode(request('unavailability'), TRUE);
|
||||
|
||||
if (cannot('add', PRIV_APPOINTMENTS))
|
||||
{
|
||||
abort(403, 'Forbidden');
|
||||
}
|
||||
|
||||
$unavailability = json_decode(request('unavailability'), TRUE);
|
||||
|
||||
$unavailability_id = $this->unavailabilities_model->save($unavailability);
|
||||
|
||||
json_response([
|
||||
|
@ -97,13 +97,13 @@ class Unavailabilities extends EA_Controller {
|
|||
{
|
||||
try
|
||||
{
|
||||
$unavailability = json_decode(request('unavailability'), TRUE);
|
||||
|
||||
if (cannot('edit', PRIV_APPOINTMENTS))
|
||||
{
|
||||
abort(403, 'Forbidden');
|
||||
}
|
||||
|
||||
$unavailability = json_decode(request('unavailability'), TRUE);
|
||||
|
||||
$unavailability_id = $this->unavailabilities_model->save($unavailability);
|
||||
|
||||
json_response([
|
||||
|
|
Loading…
Reference in a new issue