本文整理汇总了PHP中CodeProject\Repositories\ProjectRepository::skipPresenter方法的典型用法代码示例。如果您正苦于以下问题:PHP ProjectRepository::skipPresenter方法的具体用法?PHP ProjectRepository::skipPresenter怎么用?PHP ProjectRepository::skipPresenter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CodeProject\Repositories\ProjectRepository
的用法示例。
在下文中一共展示了ProjectRepository::skipPresenter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createFile
public function createFile(array $data)
{
$project = $this->repository->skipPresenter()->find($data['project_id']);
$projectFile = $project->files()->create($data);
$arquivo = $projectFile->id . "." . $data['extension'];
\Storage::put($arquivo, \File::get($data['file']));
}
示例2: createFile
public function createFile(array $data)
{
$project = $this->repository->skipPresenter()->find($data['project_id']);
//dd($project);
$projectFile = $project->files()->create($data);
$this->storage->put($projectFile->id . "." . $data['extension'], $this->filesystem->get($data['file']));
}
示例3: checkProjectPermissions
private function checkProjectPermissions($projectId)
{
$this->repository->skipPresenter(true);
if ($this->checkProjectOwner($projectId) or $this->checkProjectMember($projectId)) {
$this->repository->skipPresenter(false);
return true;
}
return false;
}
示例4: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$user_id = \Authorizer::getResourceOwnerId();
$project_id = $request->project;
$projects = $this->repository->skipPresenter()->findWhere(['id' => $project_id, 'owner_id' => $user_id]);
if (count($projects) == false) {
return ['error' => 'Access forbidden'];
}
return $next($request);
}
示例5: create
public function create(array $data)
{
try {
$this->validator->with($data)->passesOrFail();
$project = $this->projectRepository->skipPresenter()->find($data['project_id']);
$projectTask = $project->tasks()->create($data);
return $projectTask;
} catch (ValidatorException $e) {
return ['error' => true, 'message' => $e->getMessageBag()];
}
}
示例6: create
/**
* @param array $data
*
* @return array
* @throws \Prettus\Validator\Exceptions\ValidatorException
*/
public function create(array $data)
{
try {
$this->validator->with($data)->passesOrFail(ValidatorInterface::RULE_CREATE);
$project = $this->projectRepository->skipPresenter()->find($data['project_id']);
$projectFile = $project->files()->create($data);
$this->storage->put($projectFile->id . '.' . $data['extension'], $this->filesystem->get($data['file']));
return $projectFile;
} catch (ValidatorException $e) {
return ['error' => true, 'message' => $e->getMessageBag()];
}
}
示例7: deleteFile
public function deleteFile($project_id, $file_id)
{
$project = $this->repository->skipPresenter()->find($project_id);
if ($project) {
$projectFile = $project->files->find($file_id);
if ($projectFile) {
$this->storage->delete($projectFile->id . '.' . $projectFile->extension);
$projectFile->delete($file_id);
} else {
return ['error' => true, 'message' => 'Arquivo não encontrado'];
}
}
}
示例8: create
public function create(array $data)
{
try {
$this->fileValidator->with($data)->passesOrFail();
$project = $this->projectRepository->skipPresenter()->find($data['project_id']);
$projectFile = $project->files()->create($data);
$this->storage->put($projectFile->getFileName(), $this->fileSystem->get($data['file']));
return ['error' => false, 'message' => 'Arquivo inserido com sucesso!'];
} catch (ValidatorException $e) {
$error = $e->getMessageBag();
return ['error' => true, 'message' => "Erro ao enviar o arquivo, alguns campos são obrigatórios!", 'messages' => $error->getMessages()];
}
}
示例9: deleteFile
public function deleteFile($idProject, $idFile)
{
try {
// $projectFile = $this->repository->skipPresenter()->with(['files'])->find($idFile);
/*
* Busco o File do project e acesso o files que está relacionando no Project buscando o file
*/
$projectFile = $this->repository->skipPresenter()->find($idProject)->files()->find($idFile);
//pega no nome do arquivo e extensão para deletar da pasta
$nomeFile = $idFile . "." . $projectFile->extension;
//deleta da pasta
$this->filesystem->delete($nomeFile);
//return response()->json(['error' => false,'message' => "ProjectFile {$idFile} deleted"]);
} catch (ModelNotFoundException $ex) {
return $this->notFound($idFile);
}
//deleta o file da tabela
try {
$this->repository->skipPresenter()->find($idProject)->files()->detach($idFile);
} catch (ModelNotFoundException $e) {
try {
$this->repository->skipPresenter()->find($idProject)->files()->detach($idFile);
return response()->json(['error' => false, 'message' => "ProjectFile {$idFile} deleted"]);
} catch (ModelNotFoundException $e) {
return response()->json(['error' => true, 'message' => "ProjectFile {$idFile} not found"]);
}
}
}
示例10: create
public function create(array $data)
{
// diversos serviços
// enviar email
// disparar notificacao
try {
//dd($data);
$this->validator->with($data)->passesOrFail(ValidatorInterface::RULE_CREATE);
$project = $this->projectRepository->skipPresenter()->find($data['project_id']);
$projectFile = $project->files()->create($data);
$this->storage->put($projectFile->getFileName(), $this->filesystem->get($data['file']));
return $projectFile;
} catch (ValidatorException $e) {
return ['error' => true, 'message' => $e->getMessageBag()];
}
}
示例11: showMembers
/**
* @param $projectId
*
* @return array
*/
public function showMembers($projectId)
{
try {
return $this->repository->skipPresenter()->find($projectId)->members;
} catch (ValidatorException $e) {
return ['error' => true, 'message' => $e->getMessageBag()];
}
}
示例12: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
$project = $this->repository->find($id);
if ($project) {
$files = $this->repository->skipPresenter()->find($id)->files;
foreach ($files as $file) {
$this->fileService->delete($id, $file->id);
}
if ($this->repository->delete($id)) {
return ['success' => true];
} else {
return ['success' => false];
}
} else {
return ['success' => false, 'msg' => "Project not found!"];
}
}
示例13: removeMember
public function removeMember(array $data)
{
try {
$project = $this->repositoy->skipPresenter()->find($data['id']);
$user = $this->user->find($data['$memberId']);
$project->members()->detach($user);
} catch (\Exception $e) {
return ['error' => true, 'message' => $e->getMessage()];
}
}
示例14: destroy
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)
{
try {
$this->repository->skipPresenter()->find($id)->delete();
} catch (QueryException $e) {
return $this->erroMsgm('Projeto não pode ser apagado pois existe um ou mais clientes vinculados a ele.');
} catch (ModelNotFoundException $e) {
return $this->erroMsgm('Projeto não encontrado.');
} catch (NoActiveAccessTokenException $e) {
return $this->erroMsgm('Usuário não está logado.');
} catch (\Exception $e) {
return $this->erroMsgm('Ocorreu um erro ao excluir o projeto.');
}
}
示例15: deleteFile
public function deleteFile($project_id, $file_id)
{
try {
$project = $this->repository->skipPresenter()->find($project_id);
$file = $project->files->find($file_id);
if ($file) {
$file->delete();
$this->storage->delete($file_id . '.jpg');
} else {
return array('error' => 'true', 'message' => 'File does not exist');
}
} catch (ModelNotFoundException $e) {
return ['error' => true, 'message' => $e->getMessage()];
}
}