Examples of code I've written in PHP, Javascript, SCSS, etc.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

Ticket.php 817 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. }