/** * Show a specific project. * * @param Project $project * @param ProjectRepositoryInterface $repository * @return \Illuminate\View\View */ public function show(Project $project, ProjectRepositoryInterface $repository) { if ($project->stage instanceof Review) { return view('project.show', compact('project')); } if (!$project->stage instanceof Fund) { $submissions = $repository->submissions($project->id)->load('user'); return view('project.show', compact('project'))->with('submissions', $submissions); } return view('project.show')->with('project', $project->load('expenditures.expenditurable', 'backers')); }
/** * Returns all failed Projects * * @return ProjectRepository */ public function failed() { return $this->model->failed()->get(); }
/** * 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())); }); }