public function listAll() { $gifts = Gift::all(); $dataView = ['gifts' => $gifts]; return view('admin.gift.list', $dataView); }
public function create($doctorId = NULL) { $AMIds = Employee::select('id')->where('manager_id', 1)->get(); $employees = Employee::select('id')->whereIn('manager_id', $AMIds)->get(); $description_names = Customer::distinct()->select('description_name')->whereIn('mr_id', $employees)->get(); $doctors = Customer::whereIn('mr_id', $employees)->get(); $employeesLines = Employee::select('line_id')->where('manager_id', 4)->get(); $products = Product::where('line_id', $employeesLines)->get(); $gifts = Gift::all(); $dataView = ['description_names' => $description_names, 'doctors' => $doctors, 'products' => $products, 'gifts' => $gifts, 'doctorId' => !empty($doctorId) ? $doctorId : '']; return view('sm.report.create', $dataView); }
public function search() { $doctors = Customer::where('mr_id', \Auth::user()->id)->get(); $MRLine = Employee::findOrFail(\Auth::user()->id)->line_id; $products = Product::where('line_id', $MRLine)->get(); $gifts = Gift::all(); $dataView = ['doctors' => $doctors, 'products' => $products, 'gifts' => $gifts]; return view('mr.search.reports.search', $dataView); }