Created
July 17, 2017 19:30
-
-
Save freshface/92b717ba1f4e47958626b6a67a8c63df to your computer and use it in GitHub Desktop.
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
// Routes | |
$api->get('projects', 'App\Api\V1\Controllers\ProjectController@index'); | |
$api->post('projects', 'App\Api\V1\Controllers\ProjectController@store'); | |
// Controller | |
<?php | |
namespace App\Api\V1\Controllers; | |
use App\Api\V1\Models\Project; | |
use App\Api\V1\Controllers\BaseController; | |
use Dingo\Api\Http\Request; | |
class ProjectController extends BaseController | |
{ | |
public function index(Request $request) | |
{ | |
echo 'index'; | |
} | |
public function show($id) | |
{ | |
$project = Project::findOrFail($id); | |
return $this->response->array($project->toArray()); | |
} | |
public function store(Request $request) | |
{ | |
echo 'stored'; | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment