Examples of code I've written in PHP, Javascript, SCSS, etc.
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

39 rindas
817 B

  1. <?php
  2. namespace App\Http\Controllers;
  3. use Illuminate\Http\Request;
  4. use Illuminate\Support\Facades\Auth;
  5. use Mail;
  6. use Illuminate\Support\Facades\Log;
  7. use App\Models;
  8. use App\Mail\SupportTicket;
  9. class Ticket extends Controller
  10. {
  11. public function send(Request $request){
  12. $validated = $request->validate([
  13. 'topic' => 'required',
  14. 'message' => 'required'
  15. ]);
  16. $ticket = $this->create($request->topic);
  17. Mail::to('donotreply@trendplays.com')->send(new
  18. SupportTicket($ticket, $request->message));
  19. }
  20. //Should probably have a minimum character restriction later
  21. public function create(String $type){
  22. $ticket = new Models\Ticket;
  23. $ticket->user_id = Auth::user()->id;
  24. $ticket->type = $type;
  25. $ticket->status = 'processing';
  26. $ticket->complete = false;
  27. $ticket->save();
  28. return $ticket;
  29. }
  30. }