コード例 #1
0
 public function Ostore($id, PostRequest $request)
 {
     $post = new Post($request->all());
     $organization = Organization::findOrFail($id);
     $organization->posts()->save($post);
     return redirect('/home/posts');
 }
コード例 #2
0
 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');
 }
コード例 #3
0
 /**
  * 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');
 }
コード例 #4
0
 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);
     }
 }
コード例 #5
0
ファイル: SlackController.php プロジェクト: searsaw/lunch
 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]);
 }
コード例 #6
0
 /**
  * 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
     }
 }
コード例 #7
0
ファイル: Dashboard.php プロジェクト: hpsharon/laravel-site
 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;
 }
コード例 #8
0
 /**
  * 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]);
 }
コード例 #9
0
 /**
  *
  * 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'));
 }
コード例 #10
0
 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.');
     }
 }
コード例 #11
0
ファイル: Controller.php プロジェクト: AdrianKuriata/projekt
 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('/');
     }
 }
コード例 #12
0
 public function create(Request $request, $orgId)
 {
     return view('organization_orders.form', ['organization' => Organization::findOrFail($orgId), 'organizationOrder' => new OrganizationOrder()]);
 }
コード例 #13
0
 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');
 }
コード例 #14
0
ファイル: PollsController.php プロジェクト: searsaw/lunch
 /**
  * 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]);
 }
コード例 #15
0
 public function show($id)
 {
     $organization = Organization::findOrFail($id);
     return view('organizations.show')->with('organization', $organization);
 }
コード例 #16
0
 /**
  * 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'));
 }