Created
August 18, 2017 11:59
-
-
Save achmadfatoni/372e1cf72da454d58d4abc2a4072c93e to your computer and use it in GitHub Desktop.
simple_api_lumen_create_controller
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\Models\Post; | |
use Illuminate\Http\Request; | |
class PostController extends Controller | |
{ | |
public function store(Request $request) | |
{ | |
$this->validate($request, [ | |
'title' => 'required', | |
'body' => 'required' | |
]); | |
return Post::create($request->all()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment