Skip to content
This repository has been archived by the owner on Sep 12, 2022. It is now read-only.

Commit

Permalink
Return json & Add return type declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
FaZeRs committed May 11, 2018
1 parent 09cab17 commit da4ac62
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions app/Http/Controllers/Api/ContactController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,19 @@
use Illuminate\Support\Facades\Mail;

/**
* Class ContactController.
* Class ContactController
*
* @package App\Http\Controllers\Api
*/
class ContactController extends Controller
{
/**
* @param Request $request
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\JsonResponse
* @throws \Illuminate\Validation\ValidationException
*
* @return void
*/
public function send(Request $request)
public function send(Request $request): \Illuminate\Http\JsonResponse
{
$this->validate($request, [
'name' => 'required|string|max:191',
Expand All @@ -28,5 +29,7 @@ public function send(Request $request)
]);

Mail::send(new SendContact($request->only(['name', 'email', 'message'])));

return response()->json(true);
}
}

0 comments on commit da4ac62

Please sign in to comment.