本文整理汇总了PHP中CodeProject\Repositories\ProjectRepository::find方法的典型用法代码示例。如果您正苦于以下问题:PHP ProjectRepository::find方法的具体用法?PHP ProjectRepository::find怎么用?PHP ProjectRepository::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CodeProject\Repositories\ProjectRepository
的用法示例。
在下文中一共展示了ProjectRepository::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
$p = $this->repository->find($id)->delete();
if ($p) {
return "O projeto {$id} foi deletado com sucesso!";
}
}
示例2: show
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
if ($this->checkProjectPermissions($id) == false) {
return ['error' => 'Access Forbiden'];
}
return $this->repository->find($id);
}
示例3: show
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
try {
return $this->repository->find($id);
} catch (ModelNotFoundException $e) {
return ['error' => true, 'message' => 'Project not Found'];
}
}
示例4: isMember
public function isMember($project_id, $member_id)
{
$project = $this->repository->find($project_id)->members()->find(['member_id' => $member_id]);
if (count($project)) {
return true;
}
return false;
}
示例5: delete
public function delete($id)
{
try {
$this->repository->find($id)->delete();
} catch (\Exception $e) {
return ['error' => true, 'message' => $e->getMessage()];
}
}
示例6: find
public function find($id)
{
try {
return $this->repository->find($id);
} catch (ModelNotFoundException $e) {
return ['error' => true, 'message' => 'Projeto não encontrado'];
}
}
示例7: show
public function show($id)
{
try {
$rtrn = $this->repository->find($id);
return $rtrn;
} catch (ModelNotFoundException $e) {
return ['error' => true, 'message' => 'Projeto não existe'];
}
}
示例8: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
//if($this->checkProjectPermissions($id) == false){
if ($this->service->checkProjectPermissions($id) == false) {
return ['error' => 'Access Forbidden'];
}
//return $this->repository->findWhere(['project_id' => $id, 'id' => $noteId]);
return $this->repository->find($id);
//return $this->repository->with(['client', 'user'])->find($id);
}
示例9: destroy
public function destroy($id)
{
try {
$project = $this->repository->find($id);
$project->delete();
$msg['status'] = "Y";
$msg['message'] = "Successfully deleted record";
return $msg;
} catch (ValidatorException $ex) {
return ['error' => true, 'message' => $ex->getMessageBag()];
}
}
示例10: show
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
/*$userId = \Authorizer::getResourceOwnerId();
if($this->repository->isOwner($id, $userId) == false){
return ['success'=>false];
}*/
if ($this->checkProjectPermissions($id) == false) {
return ['error' => 'Access Forbidden'];
}
return $this->repository->find($id);
//return Client::find($id);
}
示例11: destroy
public function destroy($id)
{
try {
if ($this->repository->find($id)->destroy()) {
return ['error' => false, 'message' => 'Projeto deletado.'];
}
} catch (ModelNotFoundException $e) {
return ['error' => true, 'message' => 'Projeto não encontrado.'];
} catch (\PDOException $e) {
return ['success' => false, 'message' => 'Existem projetos cadastrados a este cliente!'];
}
}
示例12: update
public function update(array $data, $id)
{
try {
$this->validator->with($data)->passesOrFail();
$P = $this->repository->find($id)->update($data);
if ($P) {
// return "O projeto '".$data['name']."', foi editado com sucesso!";
return ['error' => false, 'message' => "O projeto '" . $data['name'] . "', foi editado com sucesso!"];
}
} catch (ValidatorException $e) {
return ['error' => true, 'message' => $e->getMessageBag()];
}
}
示例13: create
public function create(array $data)
{
try {
$this->validator->with($data)->passesOrFail();
$user_id = \Authorizer::getResourceOwnerId();
if ($data['owner_id'] != $user_id) {
return Errors::basic('Voce nao pode inserir um novo projeto cujo dono nao seja voce.');
}
$project = Project::create($data);
$resp = $this->projectMemberService->create(['project_id' => $project->id, 'user_id' => $data['owner_id']]);
return $this->repository->find($project->id);
} catch (ValidatorException $e) {
return Errors::basic($e->getMessageBag());
}
}
示例14: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
if ($this->isNotOwner($id) and $this->isNotMember($id)) {
return ['error' => 'Access forbirdden'];
}
$this->repository->find($id)->delete($id);
}
示例15: create
public function create($projectId, $file, array $data)
{
try {
$this->validator->with($data)->passesOrFail();
$data['extension'] = $file->getClientOriginalExtension();
$data['file'] = md5(date('Y-m-d H:i:s')) . "." . $data['extension'];
$this->storage->put($data['file'], $this->filesystem->get($file));
$project = $this->projectRepository->find($projectId);
$file = $project->files()->create($data);
return $this->find($projectId, $file->id);
} catch (ValidatorException $e) {
return ['error' => true, 'message' => $e->getMessageBag()];
} catch (\Exception $e) {
return ['error' => true, 'message' => $e->getMessage()];
}
}