|
- <?php
-
- namespace App\Http\Controllers;
-
- use Illuminate\Http\Request;
- use Illuminate\Support\Facades\Auth;
- use Mail;
- use Illuminate\Support\Facades\Log;
-
- use App\Models;
- use App\Mail\SupportTicket;
-
- class Ticket extends Controller
- {
- public function send(Request $request){
- $validated = $request->validate([
- 'topic' => 'required',
- 'message' => 'required'
- ]);
-
- $ticket = $this->create($request->topic);
-
- Mail::to('donotreply@trendplays.com')->send(new
- SupportTicket($ticket, $request->message));
- }
-
- //Should probably have a minimum character restriction later
- public function create(String $type){
- $ticket = new Models\Ticket;
- $ticket->user_id = Auth::user()->id;
- $ticket->type = $type;
- $ticket->status = 'processing';
- $ticket->complete = false;
- $ticket->save();
-
- return $ticket;
- }
- }
|