本文整理汇总了PHP中CodeProject\Repositories\ProjectRepository::with方法的典型用法代码示例。如果您正苦于以下问题:PHP ProjectRepository::with方法的具体用法?PHP ProjectRepository::with怎么用?PHP ProjectRepository::with使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CodeProject\Repositories\ProjectRepository
的用法示例。
在下文中一共展示了ProjectRepository::with方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: find
public function find($id)
{
if (is_null(Project::find($id))) {
return Errors::invalidId($id);
}
return $this->repository->with(['client', 'owner'])->find($id);
}
示例2: show
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
if ($this->checkProjectPermissions($id) == false) {
return "Access Forbidden";
}
return $this->repository->with('client')->with('user')->findOrFail($id);
}
示例3: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
// if ($this->checkProjectOwner($id)==false){
// return ['error' => 'Access forbidden'];
// }
return $this->repository->with(['owner', 'client'])->find($id);
}
示例4: show
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
if ($this->checkProjectPermissions($id) == false) {
return ['msg' => 'Forbidden'];
}
return $this->repository->with(['owner', 'notes', 'client', 'members'])->find($id);
}
示例5: listMembers
public function listMembers($id_project)
{
try {
return $this->repository->with(['members'])->find($id_project);
} catch (ModelNotFoundException $e) {
return ['error' => true, 'message' => 'Projeto não existe'];
}
}
示例6: getProject
public function getProject($id = "")
{
if ($id) {
return $this->repository->with(['owner', 'client'])->find($id);
} else {
return $this->repository->with(['owner', 'client'])->all();
}
}
示例7: show
public function show($id)
{
try {
return ["success" => $this->repository->with(['owner', 'client'])->find($id)];
} catch (ModelNotFoundException $e) {
return ["success" => false, "message" => "Projeto ID: {$id} inexistente!"];
}
}
示例8: show
public function show($id)
{
try {
return $this->repository->with(['owner', 'client', 'notes', 'tasks', 'members'])->find($id);
} catch (ModelNotFoundException $e) {
return ['error' => true, 'message' => $e->getMessage()];
}
}
示例9: read
public function read($id)
{
try {
return response()->json($this->repository->with(['owner', 'client'])->find($id));
} catch (ModelNotFoundException $ex) {
return response()->json(['error' => true, 'message' => "Project id {$id} not found"]);
}
}
示例10: find
public function find($id)
{
try {
$this->setPresenter();
return $this->repository->with(['owner', 'client'])->find($id);
} catch (\Exception $e) {
return ['error' => true, 'message' => $e->getMessage()];
}
}
示例11: show
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
try {
return $this->repository->with(['owner', 'client'])->find($id);
} catch (ModelNotFoundException $e) {
return $this->erroMsgm('Projeto não encontrado.');
} catch (\Exception $e) {
return $this->erroMsgm('Ocorreu um erro ao exibir o projeto.');
}
}
示例12: find
/**
* @param $id
* @return array|mixed
*/
public function find($id)
{
try {
return $this->repository->with(['client', 'owner', 'notes'])->find($id);
} catch (\Exception $e) {
if (get_class($e) == 'Illuminate\\Database\\Eloquent\\ModelNotFoundException') {
return ['error' => true, 'message' => 'Project does not exist' + $message];
}
}
}
示例13: show
public function show($id)
{
try {
// return $this->repository->find($id);
// return $this->repository->with(['owner', 'client'])->find($id);
return $this->repository->with(['owner', 'client'])->find($id);
} catch (Exception $e) {
return ['error' => true, 'message' => $e->getMessage()];
}
}
示例14: removeMember
public function removeMember($id, $memberId)
{
try {
//$user->roles()->detach($roleId);
//$this->repository->find($id)->members()->detach($memberId);
$this->repository->with(['members'])->find($id)->detach($memberId);
return response()->json(['error' => false, 'message' => ['removeMember' => "Member ID {$memberId} removed"]]);
} catch (ModelNotFoundException $ex) {
return ['error' => true, 'message' => 'ID not found'];
}
}
示例15: destroy
public function destroy($id)
{
if (count(self::show($id)) == 0) {
return ['error' => true, 'message' => 'Nao encontrado'];
} else {
if (count($this->repository->with(['project'])->findWhere(['id' => $id])) > 0) {
return ['error' => true, 'message' => 'Este Cliente tem Projetos'];
} else {
return $this->repository->delete($id);
}
}
}