opnform/app/Http/Controllers/Controller.php

30 lines
709 B
PHP
Raw Normal View History

2022-09-20 19:59:52 +00:00
<?php
namespace App\Http\Controllers;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
{
2024-02-23 10:54:12 +00:00
use AuthorizesRequests;
use DispatchesJobs;
use ValidatesRequests;
2022-09-20 19:59:52 +00:00
public function success($data = [])
{
return response()->json(array_merge([
2024-02-23 10:54:12 +00:00
'type' => 'success',
2022-09-20 19:59:52 +00:00
], $data));
}
public function error($data = [], $statusCode = 400)
{
return response()->json(array_merge([
2024-02-23 10:54:12 +00:00
'type' => 'error',
2022-09-20 19:59:52 +00:00
], $data), $statusCode);
}
}