My SMM panel
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

39 line
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. }