/
home
/
maktab
/
server
/
app
/
Http
/
Controllers
/
Admin
/
File Upload :
llllll
Current File: /home/maktab/server/app/Http/Controllers/Admin/EmployeeController.php
<?php namespace App\Http\Controllers\Admin; use App\Http\Controllers\InterfaceController; use App\Http\Controllers\SuperController; use App\Models\Cnt; use App\Models\User; use Illuminate\Http\Request; use Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException; class EmployeeController extends SuperController { public function __construct() { $with = ['file','maktab','type_cnt']; parent::__construct(User::class,$with,['*'],'user'); } public function index(Request $request){ $data = $request->all(); $const = Cnt::where('key','type_employee')->where('value','مربی')->first(); $query = User::with(['file','maktab','type_cnt'])->where('type',4); if (isset($data['maktab_id'])){ $query->where('maktab_id',$data['maktab_id'])->where('type_employee',$const->id);; } $serch = ['name','mobile']; $select = ['*']; $query = (new InterfaceController())->index($request->all(),$serch,$select,$query); return response()->json($query); } public function teacher_list_by_maktab(Request $request){ // return $request->maktab_list; $user = User::where("type_employee",1)->whereIn("maktab_id",$request->maktab_list)->get(); return response()->json($user); } public function store(Request $request) { $constNezamat = Cnt::where('key','type_employee')->where('value','نظامت')->first(); $request->request->add(['type'=>4]); $user = User::where('mobile',$request->mobile)->first(); if (!is_null($user)){ throw new UnprocessableEntityHttpException('این شماره همراه توسط شخص دیگری در حال استفاده است'); } if ($constNezamat->id === $request->type_employee){$request->request->add(['type'=>3]);} return parent::store($request); } }
Copyright ©2k19 -
Hexid
|
Tex7ure