jeremykenedy /
larablog
| 1 | <?php |
||
| 2 | |||
| 3 | namespace App\Http\Controllers; |
||
| 4 | |||
| 5 | use App\Http\Requests\ContactRequest; |
||
| 6 | use App\Mail\ContactMail; |
||
| 7 | use Illuminate\Support\Facades\Mail; |
||
| 8 | |||
| 9 | class ContactController extends Controller |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * Show the application contact page. |
||
| 13 | * |
||
| 14 | * @return \Illuminate\Http\Response |
||
| 15 | */ |
||
| 16 | public function index() |
||
| 17 | { |
||
| 18 | $pageData = [ |
||
| 19 | 'pageTitle' => trans('larablog.contact.pageTitle'), |
||
| 20 | 'pageDesc' => trans('larablog.contact.pageDesc'), |
||
| 21 | 'title' => trans('larablog.contact.title'), |
||
| 22 | 'subtitle' => trans('larablog.contact.subtitle'), |
||
| 23 | 'image' => config('blog.contact_page_image'), |
||
| 24 | ]; |
||
| 25 | |||
| 26 | return view('blog.pages.contact', $pageData); |
||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Send Contact Email Function via Mail. |
||
| 31 | * |
||
| 32 | * @return \Illuminate\Http\Response |
||
| 33 | */ |
||
| 34 | public function contactSend(ContactRequest $request) |
||
| 35 | { |
||
| 36 | $validatedData = $request->validated(); |
||
| 37 | |||
| 38 | Mail::to(config('blog.contact_email'))->send(new ContactMail($validatedData)); |
||
| 39 | |||
| 40 | return back()->withSuccess(trans('forms.contact.messages.sent')); |
||
|
0 ignored issues
–
show
|
|||
| 41 | } |
||
| 42 | } |
||
| 43 |