/** * Execute the command. * * @param UserRepositoryInterface $repository * @param Dispatcher $event */ public function handle(UserRepositoryInterface $repository, Dispatcher $event) { $status = $repository->update($this->user->getAttribute('id'), $this->fields); if (!$status) { dd('user wasnt updated somehow'); } $event->fire(new UserWasUpdated($this->user)); }
/** * Run the database seeds. * * @return void */ public function run() { /** * Purchase Coins */ User::all()->each(function ($user) { $this->dispatch(new PurchaseCoinCommand($user, rand(5000, 50000))); }); }
/** * @param User $user * @return bool */ public function seeReports(User $user) { return $user->hasRole('admin'); }
/** * Run the database seeds. * * @return void */ public function run() { /** * Create Project in Idea Stage */ $user = User::find(2); $fields = array('type' => 'idea', 'name' => 'My Supper Project', 'content' => 'This is a Script', 'reward' => '5'); $this->dispatch(new CreateProjectCommand($user, $fields)); /** * Get Project */ $project = Project::first(); /** * Process */ $this->openNextStage($project, $user, $project->stage->vote); /** * Start Synapse Stage */ $fields = array('content' => 'Now i will become a Synapse', 'reward' => '15'); $this->dispatch(new CreateSynapseCommand($project->id, $fields)); /** * Get Project */ $project = Project::first(); /** * Process */ $this->openNextStage($project, $user, $project->stage->vote); /** * Start Script Stage */ $fields = array('content' => 'Now i will become a Synapse', 'reward' => '500'); $this->dispatch(new CreateScriptCommand($project->id, $fields)); /** * Get Project */ $project = Project::first(); /** * Process */ $this->openNextStage($project, $user, $project->stage->vote); /** * Add Cast */ $this->addCast($project); /** * Add Crew */ $this->addCrew($project); /** * Add Expenses */ $this->addExpense($project); /** * Release the Project Back */ $review = Review::first(); $this->dispatch(new PublishProjectCommand($review)); /** * Back The Project */ collect(range(1, 20))->each(function () use($project) { $this->dispatch(new BackProjectCommand($project, User::all()->random(), rand(1, 5000))); }); /** * Enroll to Project */ $expenditures = $project->enrollable; $expenditures->each(function ($expenditure) { $this->dispatch(new EnrollProjectCommand($expenditure, User::all()->random())); }); /** * Process Project */ $this->dispatch(new OpenVotingCommand(Project::first()->stage->vote)); $enrollers = Enroller::all(); $enrollers->each(function ($enroller) { $this->dispatch(new VoteOnEnrollablePositionCommand($enroller, User::all()->random())); }); }