Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><del>Actually, <code>Redirect::to_route</code> expects a name of a route to redirect to it and a named route has to be declare with a name, like,</del></p> <p><del>Route::put('project/addvote', array('as' => 'project', 'uses'=>'projects@addvote'));</del></p> <p><del>So, you can use it;s name to redirect to it like</del></p> <p><del> return Redirect::to_route('project');</del> <del>Here, <code>project</code> has been used as it's name using <code>'as' =&gt; 'project'</code>. In, your example, you didn't gave any name to the route, here</del></p> <p><del> Route::put('project/addvote', array('uses'=>'projects@addvote'));</del> <del>The, <code>as =&gt; 'route_name'</code> is missing.</del></p> <p>For second question, you can do it as</p> <pre><code>$id = Input::get('id'); Project::find($id); Project-&gt;votenumber = 5; Project-&gt;-&gt;save(); </code></pre> <p><a href="http://three.laravel.com/docs/database/eloquent#save" rel="nofollow"><strong>Inserting &amp; Updating Models</strong></a>.</p> <h2>Update :</h2> <p>It was a bit confusing but after a conversation through the commenting system the answer for routing is give below :</p> <p>You (OP) mentioned that you have a route declared as</p> <pre><code> Route::get('projets', array('as'=&gt;'projets', 'uses'=&gt;'projets@index')); </code></pre> <p>To this route you are trying to redirect using this</p> <pre><code>return Redirect::to_route('project', $id); </code></pre> <p>So, you are passing a parameter and it's not in your route declaration and this is the problem, so to overcome this change your route declaration to this</p> <pre><code>Route::get('projets/(:num)', array('as'=&gt;'projets', 'uses'=&gt;'projets@index')); </code></pre> <p>Or</p> <pre><code>Route::get('projets/(:any)', array('as'=&gt;'projets', 'uses'=&gt;'projets@index')); </code></pre> <p>Or, you can make the param optional using a <code>?</code>, for example :</p> <pre><code>Route::get('projets/(:any?)', array('as'=&gt;'projets', 'uses'=&gt;'projets@index')); </code></pre> <p><a href="http://three.laravel.com/docs/routing#wildcards" rel="nofollow"><strong>Check wildcard Routes</strong></a>.</p> <h2>Update :</h2> <p><del>You should have postd the original code with the question, anyways,</del> Change this</p> <pre><code>return Redirect::to_route('project', $id); </code></pre> <p>to </p> <pre><code>return Redirect::to_route('project', array($id)); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload