public function store(Request $request) { $story = new Story(); // $story->location_id=$request->input('location_id'); $story->title = Input::get('title'); $story->story = Input::get('story'); $story->published = Input::get('published'); $story->save(); }
public function postCreate(Request $request) { $this->validate($request, ['title' => 'required|max:100']); $item = new Story(); $item->title = $request->title; $item->body = $request->body; $item->duration = $request->duration; $item->age = $request->age; $item->save(); return redirect('/category/stories'); }
public function store(Request $request) { $Story = new Story(); $Story->title = $request->get('title'); $Story->story = $request->get('story'); $Story->published = $request->get('published'); if (Input::get('published') === 'published') { $Story->published = 1; } else { $Story->published = 0; } $Story->location_id = $request->get('location_id'); $Story->save(); return redirect()->back(); }
/** * Store a newly created resource in storage. * * @param Request $request * @return Response */ public function store(StoryStoreRequest $request) { $project = $this->project->findByUid($request->input('project_uid')); $story = new Story(); $story->project_id = $project->id; $story->uid = str_random(12); $story->title = $request->input('title'); $story->who = $request->input('who'); $story->what = $request->input('what'); $story->why = $request->input('why'); $story->status_id = $request->input('status_id'); if ($story->save()) { Notification::success(trans('messages.story.created')); return redirect()->route('stories.show', ['uid' => $story->uid]); } Notification::error(trans('messages.story.createFailed')); return back()->withInput(); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $this->validate($request, ['title' => 'required|string|max:255']); $story = new Story(); $story->user_id = $request->user()->id; $story->save(); $translation = new StoryTranslation(); $translation->story_id = $story->id; $translation->locale = 'en'; $translation->title = $request->input('title'); $translation->save(); return redirect()->action('StoryController@edit', [$story]); }