-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add "-rest" feature in create:controller
- Loading branch information
Showing
11 changed files
with
256 additions
and
24 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php namespace App\Controllers{namespace}; | ||
|
||
use CodeIgniter\RESTful\ResourceController; | ||
|
||
class {name} extends ResourceController | ||
{ | ||
|
||
protected $modelName = '{useModel}'; | ||
protected $format = 'json'; | ||
|
||
{functions} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php namespace App\Controllers{namespace}; | ||
|
||
use CodeIgniter\RESTful\ResourcePresenter; | ||
|
||
class {name} extends ResourcePresenter | ||
{ | ||
|
||
protected $modelName = '{useModels}'; | ||
|
||
{functions} | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
src/Commands/Controller/template/rest/resourceFunctions/create
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
public function create(){ | ||
return $this->respond([ | ||
"status" => true, | ||
"msg" => "create method successful." | ||
]); | ||
} |
7 changes: 7 additions & 0 deletions
7
src/Commands/Controller/template/rest/resourceFunctions/delete
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
public function delete($id = null){ | ||
return $this->respond([ | ||
"status" => true, | ||
"id" => $id, | ||
"msg" => "delede method successful." | ||
]); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
public function edit($id = null){ | ||
return $this->respond([ | ||
"status" => true, | ||
"id" => $id, | ||
"msg" => "edit method successful." | ||
]); | ||
} |
6 changes: 6 additions & 0 deletions
6
src/Commands/Controller/template/rest/resourceFunctions/index
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
public function index(){ | ||
return $this->respond([ | ||
"status" => true, | ||
"msg" => "index method successful." | ||
]); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
public function new(){ | ||
return $this->respond([ | ||
"status" => true, | ||
"msg" => "new method successful." | ||
]); | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
public function show($id = null){ | ||
return $this->respond([ | ||
"status" => true, | ||
"id" => $id, | ||
"msg" => "show method successful." | ||
]); | ||
} |
7 changes: 7 additions & 0 deletions
7
src/Commands/Controller/template/rest/resourceFunctions/update
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
public function update($id = null){ | ||
return $this->respond([ | ||
"status" => true, | ||
"id" => $id, | ||
"msg" => "update method successful." | ||
]); | ||
} |