Esempio n. 1
0
 /**
  * Get the modal that adds a start point for a storyline
  * 
  * @param int $line_id
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function add_start($line_id)
 {
     // Get all available point types
     $point_type = PointType::where('name', 'start')->first();
     // Get all available story lines
     $story_line = Storyline::where('id', $line_id)->first();
     return view('forms.point_add_start', ['point_type' => $point_type, 'story_line' => $story_line]);
 }
Esempio n. 2
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  int $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $this->validate($request, Storyline::$validation_rules_edit);
     // Check if the name already exists but exclude the current entry
     $check = Storyline::where('name', $request->input('name'))->get();
     if (count($check) > 1) {
         Flash::success(trans('alerts.storyline.duplicate_name'));
         return redirect()->back()->withInput();
     }
     $line = Storyline::find($id);
     $line->name = $request->input('name');
     $line->description = $request->input('description');
     $line->user_id = $request->input('user_id');
     $line->color = $request->input('color');
     $line->save();
     Flash::success(trans('alerts.storyline.edited'));
     return redirect()->action('StorylineController@show', [$line->id]);
 }
Esempio n. 3
0
 /**
  * Show the application dashboard.
  *
  * @return Response
  */
 public function index()
 {
     // Check if there are any lines
     $storylines = Storyline::orderBy('id', 'desc')->take(4)->get();
     return view('pages.home', ['storylines' => $storylines]);
 }