title: Correct use of Ressource Controller in Laravel
body: <p>I use the Laravel Ressource Controller but I am not sure if I use it the right way. I start with a easy view return which I put in the create function. In this view i write a name into a textfield and click the submit button which runs the function index. Defaul index function is only index() I changed it to index(Request $request) because of the post request. But I don't believe that index is the right function for that need. Here is the complete Controller.</p>
  
  <pre><code>public function index(Request $request)
  {
      $username = $request-&gt;username;
      $user = User::where('name', $username)-&gt;select('id', 'name')-&gt;first();
  
      return view('invitation.username')-&gt;with('user', $user);
  }
  
  /**
   * Show the form for creating a new resource.
   *
   * @return \Illuminate\Http\Response
   */
  public function create()
  {
      return view('invitation.username');
  }
  
  /**
   * Store a newly created resource in storage.
   *
   * @param  \Illuminate\Http\Request  $request
   * @return \Illuminate\Http\Response
   */
  public function store(Request $request)
  {
      //
  }
  
  /**
   * Display the specified resource.
   *
   * @param  int  $id
   * @return \Illuminate\Http\Response
   */
  public function show($id)
  {
      //
  }
  
  /**
   * Show the form for editing the specified resource.
   *
   * @param  int  $id
   * @return \Illuminate\Http\Response
   */
  public function edit($id)
  {
      //
  }
  
  /**
   * Update the specified resource in storage.
   *
   * @param  \Illuminate\Http\Request  $request
   * @param  int  $id
   * @return \Illuminate\Http\Response
   */
  public function update(Request $request, $id)
  {
      //
  }
  </code></pre>
  
  <p>Where to put the code? What is the correct function for my needs? Or should I create a new function?</p>