public function Ostore($id, PostRequest $request) { $post = new Post($request->all()); $organization = Organization::findOrFail($id); $organization->posts()->save($post); return redirect('/home/posts'); }
public function Ostore(Request $request, $id) { $this->validate($request, ['title' => 'required', 'event_due' => 'required']); $event = new Event($request->all()); Organization::findOrFail($id)->events()->save($event); return redirect('/home/events'); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $organization = Organization::findOrFail($id); $name = $organization->name; $organization->delete(); session()->flash('flash_message', "The organization \"{$name}\" has been removed."); return redirect('organizations'); }
public function show($id) { $organization = Organization::findOrFail($id); $theVal = empty($this->getAuthUser()->organizations()->where('id', $id)); if (!$theVal) { return view('organizations.protectedShow')->with('organization', $organization); } else { return view('organizations.show')->with('organization', $organization); } }
public function outgoingOrder(Request $request, $id) { $organization = Organization::findOrFail($id); $order = OrganizationOrder::orderBy('created_at', 'desc')->first(); $message = "Today's lunch will be " . $order->restaurant()->name . "!"; $message .= " Make sure to <" . route('lineitem.create', [$order->id]) . "|put in your order>!"; $body = json_encode(['text' => $message]); $client = new \GuzzleHttp\Client(); $res = $client->post($organization->incoming_slack_link, ['body' => $body]); return redirect()->route('organization.view', [$organization->id]); }
/** * Execute the job. * * @param FlatCmService $service * @param WebsiteRepositoryInterface $websiteRepository */ public function handle(FlatCmService $service, WebsiteRepositoryInterface $websiteRepository) { if ($service->process($this->identifier, $this->username, $this->email, $this->password)) { $website = $websiteRepository->create(['identifier' => $this->identifier, 'username' => $this->username, 'email' => $this->email, 'is_active' => true, 'url' => 'http://' . $this->identifier . '.' . env('CMS_BASE_URL')]); $organization = Organization::findOrFail($this->organization_id); $website->organization()->associate($organization); $website->save(); //fire event } else { //fire event } }
protected function getPatients($organizationId) { $organizationName = Organization::findOrFail($organizationId)->toArray(); $patients = User::all(); $output = []; foreach ($patients as $patient) { if ($patient->hasRole('patient') && $patient->hasOrg($organizationName['name'])) { array_push($output, $patient); } } return $output; }
/** * Display a listing of the resource. * * @return Response */ public function index(Request $request, $orgId) { $organization = \App\Organization::findOrFail($orgId); $restaurants = Restaurant::orderBy('name')->get(); foreach ($restaurants as $restaurant) { $restaurant->is_used = false; if (count($organization->restaurants) > 0) { foreach ($organization->restaurants as $orgRest) { if ($orgRest->id == $restaurant->id) { $restaurant->is_used = true; } } } } return view('restaurants.list', ['restaurants' => $restaurants, 'organization' => $organization]); }
/** * * Activate CMS INSTANCE * @param WebsiteRequest $request * @param FlatCmService $service * @param WebsiteRepositoryInterface $websiteRepository * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector * @internal param FlatCmService $service * @internal param WebsiteRepositoryInterface $websiteRepository */ public function store(WebsiteRequest $request, FlatCmService $service) { $identifier = str_slug($this->organization->name, "-"); $username = $request->get('username'); $email = $request->get('email'); $password = $request->get('password'); //$this->dispatch(new CreateWebsite($this->organization->id, $identifier, $username, $email, $password)); if ($service->process($identifier, $username, $email, $password)) { $website = Website::create(['identifier' => $identifier, 'username' => $username, 'email' => $email, 'is_active' => true, 'url' => 'http://' . $identifier . '.' . env('CMS_BASE_URL')]); $organization = Organization::findOrFail($this->organization->id); $website->organization()->associate($organization); $website->save(); Flash::success(Lang::get('website.create-success')); } else { Flash: error: Lang::get('website.create-failed'); } return redirect(action('WebsiteController@index')); }
public function sendInvite(Request $request, $id) { $organization = Organization::findOrFail($id); $email = $request->input('email'); $user = User::where('email', $request->input('email'))->first(); if ($user) { Role::create(['user_id' => $user->id, 'organization_id' => $organization->id, 'role' => 'admin']); $link = url('/') . '/dashboard'; Mail::send('emails.new_invitation', ['link' => $link], function ($message) use($email) { $message->to($email)->subject('You have been invited to Lunch.run!'); }); return redirect()->route('organizationUsers', $organization)->with('status', 'The user has been added to your organization.'); } else { $token = substr(md5(rand()), 0, 20); Invitation::create(['email' => $email, 'token' => $token, 'organization_id' => $id]); $link = url('/') . '/auth/register?t=' . $token; Mail::send('emails.new_invitation', ['link' => $link], function ($message) use($email) { $message->to($email)->subject('You have been invited to Lunch.run!'); }); return redirect()->route('organizationUsers', $organization)->with('status', 'The user has been invited to your organization.'); } }
public function indexPanelLeader() { $organization = Organization::findOrFail(\Auth::user()->showPlayerId()); if (!\Auth::guest() && \Auth::user()->showPanelLeader()) { return view('main.panelLeader', compact('organization')); } else { flash()->error('Nie masz dostępu do tego panelu!'); return redirect('/'); } }
public function create(Request $request, $orgId) { return view('organization_orders.form', ['organization' => Organization::findOrFail($orgId), 'organizationOrder' => new OrganizationOrder()]); }
public function deleteOrganization($id) { $organization = Organization::findOrFail($id); $organization->delete(); flash()->error('Organizacja o ID <b>' . $id . '</b> została usunięta z bazy danych!'); return redirect('/admin/organization'); }
/** * Display a listing of the resource. * * @return Response */ public function index(Request $request, $orgId) { $organization = \App\Organization::findOrFail($orgId); return view('polls.list', ['organization' => $organization]); }
public function show($id) { $organization = Organization::findOrFail($id); return view('organizations.show')->with('organization', $organization); }
/** * Update the profile of the authenticated user * * @param OrganizationRequest|UserProfileRequest $request * @return Response */ public function update(OrganizationRequest $request) { $this->organization = Organization::findOrFail($this->organization->id); $this->organization->update($request->all()); $this->organization->save(); Flash::success(Lang::get('organization.update-success')); return redirect(action('OrganizationController@edit')); }