Ejemplo n.º 1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(TicketFormRequest $request)
 {
     $slug = uniqid();
     $ticket = new Ticket(array('title' => $request->get('title'), 'content' => $request->get('content'), 'slug' => $slug, 'user_id' => 0));
     $ticket->save();
     return redirect('/contact')->with('status', 'Your ticket has been created! Its unique id is: ' . $slug);
 }
Ejemplo n.º 2
0
 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id, TicketFormRequest $request)
 {
     $ticket = Ticket::whereid($id)->firstOrFail();
     $ticket->title = $request->get('title');
     $ticket->content = $request->get('content');
     $ticket->save();
     return redirect(action('TicketsController@edit', $ticket->id))->with('status', 'The ticket has been updated!');
 }
Ejemplo n.º 3
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(TicketFormRequest $request)
 {
     $slug = uniqid();
     $ticket = new Ticket(['title' => $request->get('title'), 'content' => $request->get('content'), 'slug' => $slug]);
     $ticket->save();
     Mail::send('emails.ticket', ['ticket' => $slug], function ($message) {
         $message->from('*****@*****.**', 'Learning Laravel');
         $message->to('*****@*****.**')->subject('There is a new ticket!');
     });
     return redirect('/contact')->with('status', 'Your ticket has been created! Its unique id is: ' . $slug);
 }
Ejemplo n.º 4
0
 public function store(TicketFormRequest $request)
 {
     $slug = uniqid();
     $ticket = new Ticket(array('title' => $request->get('title'), 'content' => $request->get('content'), 'slug' => $slug));
     $ticket->save();
     $data = array('ticket' => $slug);
     Mail::send('emails.ticket', $data, function ($message) {
         $message->from(env('EMAIL_ADDRESS'), 'Learning Laravel');
         $message->to('*****@*****.**')->subject('There is a new ticket!');
     });
     return redirect('/contact')->with('status', 'Your ticket has been created! Its unique id is: ' . $slug);
 }
Ejemplo n.º 5
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(TicketFormRequest $request, $slug)
 {
     $ticket = Ticket::whereSlug($slug)->firstOrFail();
     $ticket->title = $request->get('title');
     $ticket->content = $request->get('content');
     if ($request->get('status') != null) {
         $ticket->status = 0;
     } else {
         $ticket->status = 1;
     }
     $ticket->save();
     return redirect(action('TicketsController@edit', $ticket->slug))->with('status', 'The ticket ' . $slug . ' has been updated!');
 }
Ejemplo n.º 6
0
 public function patchUpdate(TicketFormRequest $request, $ticketId)
 {
     $ticket = \App\Ticket::find($ticketId);
     $ticket->patch($request->all());
     if (!$ticket) {
         \Flash::error('Ticket not found');
         return redirect('tickets');
     }
     $newClient = trim($request->client_new);
     if (!empty($newClient)) {
         $client = new \App\Client();
         $client->put(['name' => $newClient]);
         $ticket->patch(['client_id' => $client->id]);
     }
     \Flash::success('Ticket saved.');
     return redirect('tickets');
 }
 public function update(Ticket $ticket, TicketFormRequest $request)
 {
     $ticket->title = $request->get('title');
     $ticket->content = $request->get('content');
     if ($request->get('status') != null) {
         $ticket->status = 0;
         //0=answered
     } else {
         $ticket->status = 1;
         //1=pending
     }
     $ticket->save();
     return redirect(action('TicketsController@edit', $ticket->slug))->with('status', 'The ticket ' . $ticket->slug . ' has been updated!');
 }