44 lines
739 B
PHP
44 lines
739 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Api;
|
|
|
|
use Illuminate\Http\Request;
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\Support\Facades\Log;
|
|
use Route;
|
|
|
|
class BaseController extends Controller
|
|
{
|
|
|
|
|
|
|
|
public function __construct()
|
|
{
|
|
|
|
|
|
}
|
|
public function msg($data){
|
|
if(request()->ajax())
|
|
{
|
|
return response()->json($data);
|
|
}
|
|
return $this->htmlAlert($data);
|
|
|
|
}
|
|
public function htmlAlert($data){
|
|
echo '<script>alert("'.$data['msg'].'");window.history.back()</script>';
|
|
}
|
|
public function json($data){
|
|
$debug=\request()->input('debug');
|
|
if($debug)
|
|
{
|
|
dd($data);
|
|
}
|
|
return response()->json($data);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} |