You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1003 B
PHP
44 lines
1003 B
PHP
<?php
|
|
|
|
use Illuminate\Http\Exceptions\HttpResponseException;
|
|
use Illuminate\Support\Str;
|
|
|
|
class Yo
|
|
{
|
|
public static function create_echo($id = 0)
|
|
{
|
|
return Lu::echo(config('code.200.c'), 200, ['id' => $id]);
|
|
}
|
|
|
|
public static function delete_echo($id = 0)
|
|
{
|
|
return Lu::echo(config('code.200.d'), 200, ['id' => $id]);
|
|
}
|
|
|
|
public static function update_echo($id = 0)
|
|
{
|
|
return Lu::echo(config('code.200.u'), 200, ['id' => $id]);
|
|
}
|
|
|
|
public static function error_echo($code, $replace = [])
|
|
{
|
|
$msg = config("code.{$code}");
|
|
if (count($replace)) $msg = Str::replaceArray('?', $replace, $msg);
|
|
throw new HttpResponseException(response()->json(Lu::echo($msg, $code)));
|
|
}
|
|
|
|
public static function error_exit($exit)
|
|
{
|
|
throw new HttpResponseException(response()->json(Lu::echo(
|
|
$exit['message'],
|
|
$exit['code'],
|
|
$exit['data']
|
|
)));
|
|
}
|
|
|
|
public static function echo($data = [])
|
|
{
|
|
return Lu::echo(config('code.200.r'), 200, $data);
|
|
}
|
|
}
|