/**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     ProjectTask::created(function ($task) {
         event(new TaskWasIncluded($task));
     });
     ProjectTask::updated(function ($task) {
         event(new TaskWasChanged($task));
     });
 }
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     ProjectTask::created(function ($task) {
         Event::fire(new TaskWasIncluded($task));
     });
     ProjectTask::updated(function ($task) {
         Event::fire(new TaskWasUpdated($task));
     });
 }
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     if (!App::runningInConsole()) {
         //código para não executar quando estamos rodando a aplicação via console
         ProjectTask::created(function ($task) {
             Event::fire(new TaskWasIncluded($task));
         });
     }
 }
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     if (app()->runningInConsole()) {
         return;
     }
     ProjectTask::created(function ($task) {
         Event::fire(new TaskWasIncluded($task));
     });
     ProjectTask::updated(function ($task) {
         Event::fire(new TaskChanged($task));
     });
 }
Ejemplo n.º 5
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $task_id = $request->task;
     $user_id = \Authorizer::getResourceOwnerId();
     $task = ProjectTask::find($task_id);
     if (is_null($task)) {
         return Errors::invalidId($task_id);
     }
     if (!$this->repository->isMember($task->project_id, $user_id)) {
         return Errors::basic('Acesso negado! Você não é membro do projeto desta tarefa.');
     }
     return $next($request);
 }
Ejemplo n.º 6
0
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     #tentativa frustrada de adicionar o owner como member
     /*Project::saved(function($project){
           dd($project);
       });*/
     ProjectTask::created(function ($task) {
         //event();
         Event::fire(new TaskWasIncluded($task));
     });
     ProjectTask::updated(function ($task) {
         //event();
         if ($task->status == 2) {
             Event::fire(new TaskWasConcluded($task));
         } else {
             Event::fire(new TaskWasUpdated($task));
         }
         //if($tas)
     });
 }
Ejemplo n.º 7
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Eloquent::unguard();
     /*Desativa chave etrangeira*/
     DB::statement('SET FOREIGN_KEY_CHECKS=0;');
     \CodeProject\Entities\ProjectTask::truncate();
     \CodeProject\Entities\ProjectMember::truncate();
     \CodeProject\Entities\ProjectNote::truncate();
     \CodeProject\Entities\Project::truncate();
     \CodeProject\Entities\Client::truncate();
     \CodeProject\Entities\User::truncate();
     $this->call(UserTableSeeder::class);
     $this->call(ClientTableSeeder::class);
     $this->call(ProjectTableSeeder::class);
     $this->call(ProjectNoteTableSeeder::class);
     $this->call(ProjectMembersTableSeeder::class);
     $this->call(ProjectTasksTableSeeder::class);
     /*ativa chave estrangeira*/
     DB::statement('SET FOREIGN_KEY_CHECKS=1;');
 }
Ejemplo n.º 8
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     DB::statement('SET FOREIGN_KEY_CHECKS=0;');
     Project::truncate();
     User::truncate();
     Client::truncate();
     ProjectNote::truncate();
     ProjectTask::truncate();
     ProjectMember::truncate();
     OauthClient::truncate();
     DB::statement('SET FOREIGN_KEY_CHECKS=1;');
     $this->call(ClientTableSeeder::class);
     $this->call(UserTableSeeder::class);
     $this->call(ProjectTableSeeder::class);
     $this->call(ProjectNoteTableSeeder::class);
     $this->call(ProjectTaskTableSeeder::class);
     $this->call(ProjectMemberTableSeeder::class);
     $this->call(OauthClientSeeder::class);
     Model::reguard();
 }
Ejemplo n.º 9
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     DB::statement('SET foreign_key_checks = 0');
     ProjectNote::truncate();
     ProjectTask::truncate();
     ProjectMember::truncate();
     ProjectFile::truncate();
     Project::truncate();
     Client::truncate();
     User::truncate();
     OAuthClient::truncate();
     DB::statement('SET foreign_key_checks = 1');
     $this->call(UserTableSeeder::class);
     $this->call(ClientTableSeeder::class);
     $this->call(ProjectTableSeeder::class);
     $this->call(ProjectNoteTableSeeder::class);
     $this->call(ProjectMemberTableSeeder::class);
     $this->call(ProjectTaskTableSeeder::class);
     $this->call(OAuthClientTableSeeder::class);
     Model::reguard();
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     ProjectTask::truncate();
     factory(ProjectTask::class, 50)->create();
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     \CodeProject\Entities\ProjectTask::truncate();
     factory(\CodeProject\Entities\ProjectTask::class, 50)->create();
 }
 public function transform(ProjectTask $model)
 {
     return ['id' => $model->id, 'project_id' => $model->project_id, 'name' => $model->name, 'start_date' => $model->getStartDate(), 'due_date' => $model->getDueDate(), 'status' => $model->status, 'created_at' => $model->getCreatedAt(), 'updated_at' => $model->getUpdatedAt()];
 }
Ejemplo n.º 13
0
 public function delete($task_id)
 {
     $task = ProjectTask::find($task_id);
     if (is_null($task)) {
         return Errors::invalidId($task_id);
     }
     $user_id = \Authorizer::getResourceOwnerId();
     if (!$this->projectRepository->isMember($task->project_id, $user_id)) {
         return Errors::basic('Acesso negado. Você não é membro do projeto desta tarefa.');
     }
     $this->repository->delete($task_id);
     return ['message' => "Registro deletado!"];
 }
 public function includeProject(ProjectTask $projectTask)
 {
     return $this->collection($projectTask->project()->get(), new ProjectTransformer());
 }