dimanche 3 juin 2018

How to add request data to support email using Illuminate\Http\Request;

I created a "Ask for support" contact form (using a modal) in my app. What would be the best/cleanest way to add/attach a dump of the $request variable? (PHP's global variables, session data, ...) Because I believe this data can help me a lot to debug.

What I tried:

SupportController:

public function send(Request $request)
    {
        Mail::send('emails.support', ['request' => $request], function ($message) use ($request) {
            $message->from($request->user()->email, $request->user()->name);
            $message->subject(trans('Support request'));
        });

        $request->session()->flash('flash_message', __('Message sent!'));
        return redirect()->back();
    }

emails.support.blade

But I get a memory size exhausted error message (even after I changed the limit to 1GB).

So there might be a better way to do this. Maybe also a more readable way.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire