12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- namespace app\common\service;
- use app\common\model\Project;
- use app\common\service\Service;
- use app\common\util\WhereBuilder;
- class ProjectService extends Service
- {
- public function page($param = [])
- {
- $this->autoParams($param);
- $status = $this->pg('status');
- $keyword = $this->pg('keyword');
-
- $where = WhereBuilder::builder()
- ->like('keyword', $keyword)
- ->in('status', $status)
- ->build();
- return (new Project)
- ->with(['contracts', 'schedules'])
- ->where($where)
- ->paginate($this->tp6Page());
- }
- public function create($param = [])
- {
- $param = $this->autoParams($param);
- return Project::create($param);
- }
- public function info($param = [])
- {
- $this->autoParams($param);
- $project = $this->one(Project::class);
- $project->append(['contracts', 'schedules']);
- return $project;
- }
- public function update($param = [])
- {
- $param = $this->autoParams($param);
- return Project::update($param);
- }
- public function delete($param = [])
- {
- $this->autoParams($param);
- $project = $this->one(Project::class);
- return $project->delete();
- }
- }
|