Skip to content

Instantly share code, notes, and snippets.

@achmadfatoni
Created August 18, 2017 11:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save achmadfatoni/372e1cf72da454d58d4abc2a4072c93e to your computer and use it in GitHub Desktop.
Save achmadfatoni/372e1cf72da454d58d4abc2a4072c93e to your computer and use it in GitHub Desktop.
simple_api_lumen_create_controller
<?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