コード例 #1
0
 /**
  * Report post
  *
  * @return mixed
  */
 public function postReport()
 {
     if ($this->post->user_id == \Auth::user()->id) {
         \Flash::danger("Why would you report your own post?!", 'post-' . $this->post->id);
     } elseif ($this->reporter->report($this->post->id, \Auth::user()->id)) {
         \Flash::success('Thanks for reporting a post. Somebody with power will look at it soon ^_^.', 'post-' . $this->post->id);
     } else {
         \Flash::danger("You've already reported this post.", 'post-' . $this->post->id);
     }
     return $this->getShow();
 }
コード例 #2
0
 public function destroy(DiscountFormRequest $request, $id)
 {
     $event = Event::find($request->input('event'));
     $discount = Discount::find($id);
     if ($discount && $event->user_id == $request->user()->id) {
         $discount->delete();
         \Flash::success('Discount deleted');
     } else {
         \Flash::danger('Sorry, permission denied');
     }
     //return redirect(action('EventsController@admin', $request->input('event')));
     return Redirect::back()->with(['tabName' => 'discounts']);
 }
コード例 #3
0
 /**
  * Vote a post up or down
  *
  * @param int $postId
  * @param string $direction
  * @return \Illuminate\Http\RedirectResponse
  */
 public function getVote($topicType, $postId, $direction)
 {
     // Vote if does not own post
     if ($this->post->user_id != \Auth::user()->id) {
         // Vote post up
         if ($direction == 'up') {
             $this->voter->increment($postId, \Auth::user()->id);
         } elseif ($direction == 'down') {
             $this->voter->decrement($postId, \Auth::user()->id);
         }
     } else {
         Flash::danger(_('You cannot vote your own post!'), 'post-' . $postId);
     }
     return $this->getShow();
 }
コード例 #4
0
 /**
  * Delete an extra
  * @param Request $request
  * @param $id
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function destroy(Request $request, $id)
 {
     $event = Event::find($request->input('event'));
     $extra = Extra::find($id);
     if ($extra && $event->user_id == $request->user()->id) {
         $extra->delete();
         //Flash a message to the user
         \Flash::success('Extra deleted');
     } else {
         //Flash a message to the user
         \Flash::danger('Sorry, permission denied');
     }
     //Redirect back to the admin page
     //return redirect(action('EventsController@admin', $request->input('event')));
     return Redirect::back()->with(['tabName' => 'extras']);
 }
コード例 #5
0
 /**
  * @param Request $request
  * @param $id
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function destroy(Request $request, $slug)
 {
     //$event = Event::find($id);
     $event = Event::where('slug', '=', $slug)->firstOrFail();
     //Delete this event.
     if ($event && $event->user_id == $request->user()->id) {
         $event->delete();
         //Flash a message to the user
         \Flash::success('Event deleted');
     } else {
         //Flash a message to the user
         \Flash::danger('Sorry, permission denied');
     }
     //Redirect back to the admin page
     return redirect(action('PagesController@userEvents'));
 }
コード例 #6
0
 /**
  * Delete a detail
  * @param Request $request
  * @param $id
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function destroy(Request $request, $id)
 {
     $event = Event::find($request->input('event'));
     $detail = Detail::find($id);
     if ($detail && $event->user_id == $request->user()->id) {
         $detail->delete();
         //Flash a message to the user
         \Flash::success('Detail deleted');
     } else {
         //Flash a message to the user
         \Flash::danger('Sorry, permission denied');
     }
     $event = Event::findOrFail($request->input('event'));
     //Redirect back to the admin page
     return redirect(action('EventsController@admin', $event->slug));
 }
コード例 #7
0
 /**
  * Can't edit post. Wrong permissions or not owner.
  */
 protected function cantEditPost()
 {
     Flash::danger(_("You can't edit this post."));
     return $this->redirectToTopic();
 }
コード例 #8
0
 /**
  * {@inheritDocs}
  */
 public function noAccessReturn($topic)
 {
     \Flash::danger(_("You don't have permission to lock topics."));
     return $this->redirectToTopic($topic);
 }
コード例 #9
0
 /**
  * {@inheritDocs}
  */
 public function cantDeleteFirstPost()
 {
     Flash::danger(_("You can't delete the first post in a topic"));
     return Redirect::route('forums.posts.delete', ['topicType' => Route::current()->parameter('topicType'), 'post' => $this->post->id]);
 }
コード例 #10
0
 function uploadAttachment()
 {
     $upload_rules = ['attachment' => 'required|mimes:doc,docx,pdf,txt,xls,xlsx'];
     $validator = \Validator::make($this->request->all(), $upload_rules);
     if ($validator->fails()) {
         return redirect()->back()->withErrors($validator)->withInput();
     }
     $application_id = $this->request->route('id');
     if ($this->request->hasFile('attachment') and $this->request->file('attachment')->isValid()) {
         $destinationPath = 'resources/uploads/attachments';
         // upload path
         $extension = $this->request->file('attachment')->getClientOriginalExtension();
         // get file extension
         $fileName = uniqid() . '_' . time() . '.' . $extension;
         $this->request->file('attachment')->move($destinationPath, $fileName);
         \Flash::success('File uploaded successfully!');
         $this->lead->uploadAttachment($application_id, $fileName);
         return redirect()->route('system.lead.accepted');
     } else {
         \Flash::danger('Uploaded file is not valid!');
         return redirect()->back();
     }
 }
コード例 #11
0
 /**
  * {@inheritDocs}
  */
 public function noAccessReturn($topic)
 {
     \Flash::danger(_('You are not a qualified mover.'));
     return \Redirect::route('forums.topics.show', ['id' => $topic->id, 'slug' => $topic->slug]);
 }
コード例 #12
0
 /**
  * {@inheritDocs}
  */
 public function noAccessReturn($topic)
 {
     \Flash::danger(_('You have no glue to sticky this topic.'));
     return $this->redirectToTopic($topic);
 }
コード例 #13
0
 /**
  * {@inheritDocs}
  */
 public function noAccessReturn($topic)
 {
     Flash::danger(_("You can't delete this topic :/"));
     return Redirect::route('forums.topics.show', ['id' => $topic->id, 'slug' => $topic->slug]);
 }
コード例 #14
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $request = Vimeo::request('/videos/' . $this->video->getVimeoId(), [], 'DELETE');
     if ($request['status'] != 204) {
         \Log::info('Verificar DELETE video ' . $this->video->getVimeoId() . 'en vimeo');
     }
     try {
         $this->video->delete();
         \Flash::info('Video eliminado correctamente');
     } catch (QueryException $e) {
         \Flash::danger('El video no se pudo eliminar');
     }
     return redirect()->route('protocols.show', $this->protocol);
 }