You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
918 B
39 lines
918 B
<?php
|
|
|
|
namespace App\Http\Controllers\Api;
|
|
|
|
use App\Entities\Projects\ProjectsRepository;
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\Http\Request;
|
|
|
|
class ProjectsController extends Controller
|
|
{
|
|
private $repo;
|
|
|
|
public function __construct(ProjectsRepository $repo)
|
|
{
|
|
$this->repo = $repo;
|
|
}
|
|
public function index(Request $request)
|
|
{
|
|
return $this->repo->getProjects($request->get('q'), $request->get('status_id'));
|
|
}
|
|
|
|
public function show($id)
|
|
{
|
|
return $this->repo->requireById($id);
|
|
}
|
|
|
|
public function features($id)
|
|
{
|
|
$project = $this->repo->requireById($id);
|
|
// $project->load('features.tasks');
|
|
$response = fractal()
|
|
->item($project->toArray())
|
|
->transformWith(function($project) {
|
|
return $project;
|
|
})
|
|
->toArray();
|
|
return $response;
|
|
}
|
|
}
|