| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- namespace App\Http\Controllers;
- use App\Log;
- use App\User;
- use Illuminate\Foundation\Bus\DispatchesJobs;
- use Illuminate\Routing\Controller as BaseController;
- use Illuminate\Foundation\Validation\ValidatesRequests;
- use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
- use Illuminate\Support\Facades\Auth;
- use Illuminate\Support\Facades\Request;
- use Illuminate\Support\Str;
- use Zttp\Zttp;
- class Controller extends BaseController
- {
- use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
- static public function logS($method,$type,$description,$id_user=null){
- if(!$id_user){
- $id_user = '';
- $user=auth()->user();
- if($user) $id_user = $user['id'];
- }
- (new Log([
- 'operation'=>$method,
- 'type'=>$type,
- 'description'=>$description,
- 'id_user'=>$id_user,
- 'ip'=>Request::ip()
- ]))->save();
- }
- public function log($method,$type,$description,$id_user=null){
- (new Log([
- 'operation'=>$method,
- 'type'=>$type,
- 'description'=>$description,
- 'id_user'=>$id_user,
- 'ip'=>Request::ip()
- ]))->save();
- }
- public function apiError($method,$description){
- $this->log($method,'apiError',$description);
- return ['success'=>'false','fail_info'=>$description];
- }
- }
|