src/Controllers/TicketsController.php
public function store(Request $request)
    {
        $this->validate($request, [
            'subject'     => 'required|min:3',
            'content'     => 'required|min:6',
            'priority_id' => 'required|exists:ticketit_priorities,id',
            'category_id' => 'required|exists:ticketit_categories,id',
        ]);

        $ticket = new Ticket();

        $ticket->subject = $request->subject;

        $ticket->setPurifiedContent($request->get('content'));

        $ticket->priority_id = $request->priority_id;
        $ticket->category_id = $request->category_id;

        $ticket->status_id = Setting::grab('default_status_id');
        $ticket->user_id = auth()->user()->id;
        $ticket->autoSelectAgent();

        $ticket->save();

        session()->flash('status', trans('ticketit::lang.the-ticket-has-been-created'));

        return redirect()->action('\Kordy\Ticketit\Controllers\TicketsController@index');
    }
public function store(Request $request)
    {
        $this->validate($request, [
            'subject'     => 'required|min:3',
            'content'     => 'required|min:6',
            'priority_id' => 'required|exists:ticketit_priorities,id',
            'category_id' => 'required|exists:ticketit_categories,id',
        ]);

        $ticket = new Ticket();

        $ticket->subject = $request->subject;

        $ticket->setPurifiedContent($request->get('content'));

        $ticket->priority_id = $request->priority_id;
        $ticket->category_id = $request->category_id;

        $ticket->status_id = Setting::grab('default_status_id');
        $ticket->user_id = auth()->user()->id;
        $ticket->autoSelectAgent();

        $ticket->save();

        session()->flash('status', trans('ticketit::lang.the-ticket-has-been-created'));

        return redirect()->action('\Kordy\Ticketit\Controllers\TicketsController@index');
    }
public function store ( Request $ request ) { $ this -> validate ( $ request , [ 'subject' => 'required|min:3' , 'content' => 'required|min:6' , 'priority_id' => 'required|exists:ticketit_priorities,id' , 'category_id' => 'required|exists:ticketit_categories,id' , ] ) ; $ ticket = new Ticket ( ) ; $ ticket -> subject = $ request -> subject ; $ ticket -> setPurifiedContent ( $ request -> get ( 'content' ) ) ; $ ticket -> priority_id = $ request -> priority_id ; $ ticket -> category_id = $ request -> category_id ; $ ticket -> status_id = Setting :: grab ( 'default_status_id' ) ; $ ticket -> user_id = auth ( ) -> user ( ) -> id ; $ ticket -> autoSelectAgent ( ) ; $ ticket -> save ( ) ; session ( ) -> flash ( 'status' , trans ( 'ticketit::lang.the-ticket-has-been-created' ) ) ; return redirect ( ) -> action ( '\Kordy\Ticketit\Controllers\TicketsController@index' ) ; }
Store a newly created ticket and auto assign an agent for it.

@param Request $request

@return \Illuminate\Http\RedirectResponse
Store a newly created ticket and auto assign an agent for it .