/** * Validate the input and store the profile field in the database. * * @param \Illuminate\Http\Request $request * @param int $projectId * * @return Response */ public function store(Request $request, $projectId) { $project = Project::findOrFail($projectId); $this->validate($request, $this->createProfileRules); $profile = ProjectProfile::create(['project_id' => $project->id, 'title' => $request->input('title'), 'value' => $request->input('value'), 'translatable' => $request->input('translatable', false)]); if (!isset($profile)) { abort(503); } return redirect()->route('project.show', ['project' => $project->id]); }
/** * Create a random ProjectProfile entry. * * @param int VisualAppeal\Connect\Project $project (Default: null, newly created) * * @return VisualAppeal\Connect\ProjectProfile */ public function createProjectProfile($project = null) { $project = $project ?: $this->createProject(); return \VisualAppeal\Connect\ProjectProfile::create(['project_id' => $project->id, 'title' => $this->faker->word, 'value' => $this->faker->word, 'translatable' => $this->faker->boolean(50)]); }