...
This commit is contained in:
parent
a9e7afd13a
commit
ba3de1ae99
31 changed files with 329 additions and 5 deletions
|
|
@ -0,0 +1,35 @@
|
|||
https://www.youtube.com/watch?v=-NIoOj-FtHE&list=PLT9miexWCpPW6Z_OXNv2d78cqCrZaPrVG&index=36
|
||||
|
||||
ProjectController.php
|
||||
```php
|
||||
public function listProjects()
|
||||
{
|
||||
$user_id = auth()->id();
|
||||
$pm = new ProjectModel();
|
||||
|
||||
$projectData = $pm->where([
|
||||
"user_id" => $user_id
|
||||
])->findAll();
|
||||
|
||||
if (count($projectData)>0) {
|
||||
$response = [
|
||||
"status" => true,
|
||||
"message" => "Project data",
|
||||
"data" => $projectData
|
||||
];
|
||||
}else {
|
||||
$response = [
|
||||
"status" => false,
|
||||
"message" => "No Project data found",
|
||||
"data" => []
|
||||
];
|
||||
}
|
||||
|
||||
return $this->respondCreated($response);
|
||||
}
|
||||
```
|
||||
|
||||
Routes.php
|
||||
```php
|
||||
$routes->get("list-projects", "ProjectController::listProjects", ["filter" => "apiauth"]);
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue