public function delete(Request $request, $id) { $page = Page::findOrFail($id); $title = $page->title; $page->delete(); return redirect()->route('admin.page.index')->with('messages', ['Page ' . $title . ' is successfully deleted.']); }
public function contact(Request $request) { if ($request->isMethod('POST')) { $rules = ['fullname' => 'required', 'email' => 'required|email', 'contact_number' => 'required', 'message' => 'required|min:10']; $this->validate($request, $rules); $messageVars = ['name' => $request->input('fullname'), 'email' => $request->input('email'), 'phone' => $request->input('contact_number'), 'subject' => $request->input('subject'), 'content' => $request->input('message')]; SubscribeHelper::subscribe('website_database', $messageVars['email'], $messageVars['name'], null, ['phone' => $messageVars['phone']]); Mail::send('frontend.emails.contact', $messageVars, function ($m) { $m->from(config('app.contact_from_email'), config('app.contact_from_name')); $m->to(config('app.contact_destination'))->subject('Inquiry Form'); }); return redirect()->refresh()->with('messages', [trans('contact.success_message')]); } $content = Page::where('identifier', 'contact')->first(); return view('frontend.page.contact', ['content' => $content]); }
public function referralListing(Request $request) { $rules = ['name' => 'required', 'email' => 'required|email|unique:users,email', 'contact_number' => 'required', 'address' => 'required|min:10', 'province' => 'required', 'city' => 'required', 'subdistrict' => 'required']; if ($request->isMethod('POST')) { $this->validate($request, $rules); $formSubmission = new FormSubmission(); $formSubmission->fill(['email' => $request->input('email'), 'ip_address' => $request->ip(), 'user_agent' => $request->header('User-Agent')]); $formSubmission->saveData([$request->except('_token')]); $formSubmission->save(); $password = str_random(8); $user = new User(['email' => $request->input('email'), 'status' => User::STATUS_ACTIVE, 'password' => bcrypt($password)]); $user->manage_property = FALSE; $user->save(); $user->assignRole('agent'); $names = explode(' ', $request->input('name')); $profile = new Profile(); $profile->fill(['first_name' => array_shift($names), 'last_name' => !empty($names) ? implode(' ', $names) : '', 'mobile_phone_number' => $request->input('contact_number'), 'address' => $request->input('address'), 'province' => $request->input('province'), 'city' => $request->input('city'), 'subdistrict' => $request->input('subdistrict')]); $profile->user()->associate($user); $profile->save(); $user->load('profile'); $messageVars = ['name' => $request->input('name'), 'email' => $request->input('email'), 'phone' => $request->input('contact_number'), 'address' => $request->input('address'), 'province' => $request->input('province'), 'city' => $request->input('city'), 'subdistrict' => $request->input('subdistrict')]; SubscribeHelper::subscribe('referral_agent', $messageVars['email'], $messageVars['name'], null, ['phone' => $messageVars['phone']]); Mail::send('frontend.emails.referral_listing', $messageVars, function ($m) { $m->from(config('app.contact_from_email'), config('app.contact_from_name')); $m->to(config('app.contact_destination'))->subject('Referral Listing Registration'); }); $this->notifyReferralAgent($user, $password); return redirect()->refresh()->with('messages', [trans('contact.referral_listing_registration_msg')]); } $validator = JsValidatorFacade::make($rules); $content = Page::where('identifier', 'referral-listing')->first(); return view('frontend.page.referral_listing', ['validator' => $validator, 'content' => $content]); }
public function getPropertyPhotos($id) { $property = Property::findOrFail($id); $page = Page::where('identifier', 'presentation-is-key')->first(); return view('frontend.property.property_photos', ['model' => $property, 'page' => $page]); }