/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $input = Request::all(); $zone = new Zone(); $zone->id = $input['id']; $zone->Zone_Name = $input['name']; $zone->Zone_Address = $input['address']; $zone->Total_Spots = $input['t_spots']; $zone->Working_Hours = $input['w_hours']; $zone->save(); //dd($zone); return view('success'); }
public function zone($id) { if ($this->role == "admin") { return Zone::find($id); } return $this->belongsToMany('App\\Zone', 'user_zone', 'user', 'zone')->getQuery()->whereRaw('id = ' . $id)->first(); }
public function update($id, Request $request) { $this->validate($request, ['name' => 'required', 'display_name' => 'required', 'status' => 'required|in:Disabled,Enabled']); $zone = Zone::findOrFail($id); $zone->name = $request->name; $zone->display_name = $request->display_name; $zone->status = $request->status; $zone->save(); return redirect()->route('admin.zone.index'); }
public function summaryByAdmin($id) { $booking = Booking::where('code', $id)->get()->first(); $detail = BookingDetail::where('bookingCode', $id)->get(); foreach ($detail as $key => $value) { # code... $zone = Zone::where('code', $value->zoneCode)->get()->first(); $detail->zoneName = $zone->name; } $user = session()->get('member'); //var_dump($booking , $detail); return view('booking.summarybyadmin', ['booking' => $booking, 'detail' => $detail, 'user' => $user]); }
/** * Show the form for creating a new resource. * * @return Response */ public function create() { $domainId = SiteConfig::whereParameter('domainId')->first()->data; // Get all active zones, packages and templates $zones = Zone::whereStatus('Enabled')->get(); $packages = Package::all(); $templates = TemplateGroup::all(); $myTemplates = $this->acs->listTemplates(['account' => Auth::User()->email, 'domainid' => $domainId, 'templatefilter' => 'self']); $diskTypes = DiskType::all(); $sshKeys = $this->acs->listSSHKeyPairs(['account' => Auth::User()->email, 'domainid' => $domainId]); $secGroups = $this->acs->listSecurityGroups(['account' => Auth::User()->email, 'domainid' => $domainId]); return view('instance.create')->with(compact('zones', 'packages', 'templates', 'myTemplates', 'diskTypes', 'sshKeys', 'secGroups')); }
private function canAddPTR($zone, $ip) { $this->resolver->signTSIG(\Crypt::decrypt($zone->tsigname), \Crypt::decrypt($zone->tsigkey)); try { $result = $this->resolver->query($this->getReverseIP($ip) . '.in-addr.arpa', "PTR"); } catch (\Net_DNS2_Exception $e) { $result = $e->getResponse(); } $zoner = null; if ($result->header->aa == 1) { foreach ($result->authority as $a) { //try to find zone in db $zoner = \App\Zone::where('name', $a->name)->where('reverse', 1)->first(); if ($zoner != null) { break; } } } return $result->header->aa == 1 ? $zoner : null; }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { Zone::destroy($id); return redirect('/admin/zone'); }
Route::get('/inform', 'InformController@index'); Route::get('/inform/monthly', 'InformController@indexMonthly'); Route::get('/inform/feed', 'InformController@feed'); Route::get('/inform/monthly/feed', 'InformController@feedMonthly'); Route::post('/inform/upload', 'InformController@upload'); Route::put('/inform/update/{id}', 'InformController@update'); Route::put('/inform/monthly/update/{id}', 'InformController@updateMonthly'); Route::get('/history', 'HistoryController@index'); Route::post('/history/get', 'HistoryController@show'); Route::get('/history/detail/{id}', 'HistoryController@edit'); }); Route::get('/admin', 'Backend\\HomeController@index'); Route::get('/admin/signin', 'Backend\\HomeController@signin'); Route::get('/admin/signout', 'Backend\\HomeController@signout'); Route::get('/admin/get/zone', function () { $zone = Zone::where('active', 1)->get(); return response()->json($zone); }); Route::get('/admin/get/calendar', function () { $events = Calendar::where('active', '1')->groupBy('opened_at')->get(); $events_inv = Calendar::where('active', 0)->groupBy('opened_at')->get(); return response()->json(['active' => $events, 'inactive' => $events_inv]); }); Route::get('/admin/get/zone/{date}', function ($date) { $zone = Calendar::where('active', '1')->where('opened_at', $date)->get(); return response()->json(['zone' => $zone]); }); Route::get('/admin/get/calendar/{date}', function ($date) { $events = Calendar::where('active', '1')->where('opened_at', $date)->get(); return response()->json($events); });
public function postRemove() { if (\Auth::user()->role != "admin") { abort(401); } \App\Zone::destroy(\Input::get("id")); return $this->getAllZones(); }
/** * @param $all * @return array */ private function handleZoneAnalytics($all) { $subcomponent = $all['subcomponents']; $zone = Zone::findOrFail($all['zones']); $repairshops = $zone->repairshop; return $this->returnAnalysis($repairshops, $subcomponent, 'zone', $zone); }