Created
August 6, 2018 12:08
-
-
Save mitrallex/5e1c17155d10aa83359b72cb64aea9aa to your computer and use it in GitHub Desktop.
laravel-google-recaptcha
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Controllers; | |
use App\Http\Requests\FeedbackRequest; | |
use Illuminate\Http\Request; | |
use Illuminate\Http\Response; | |
use App\Feedback; | |
class FeedbackController extends Controller | |
{ | |
public function index() | |
{ | |
$feedbacks = Feedback::orderBy('id', 'desc')->paginate(10); | |
return view('feedback.index', compact('feedbacks')); | |
} | |
public function create() | |
{ | |
return view('feedback.create'); | |
} | |
public function store(FeedbackRequest $request) | |
{ | |
$feedback = new Feedback(); | |
$feedback->name = $request['name']; | |
$feedback->email = $request['email']; | |
$feedback->message = $request['message']; | |
return response()->json([ | |
'success' => $feedback->save() | |
]); | |
} | |
public function destroy($id) | |
{ | |
$feedback = Feedback::find($id); | |
$feedback->delete(); | |
return redirect(action('FeedbackController@index')); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment