php - Using URL data in laravel views -


It is trying to understand what I would normally do in simple PHP.

I have the following URL:

  / viewbuild / 2  

The objective is that the viewbuild view is 2 and 2 of the database row ID is.

Normally this would be:

  $ id = $ _GET ['id'];  

But it correctly detects it to use larval.

This is my route:

  Root :: find ('Viewbuild', function () {return see :: create ('view');});  

And on my idea I have done this:.

   Id}}  

This searches for the build table for a row with the ID of 2 and then displays its ID.

I now have to draw the '20' value from the URL. I have tried:

  Root :: find ('/ viewbuild / {build_id}', function ($ build_id = null) {$ data = array (' Build_id '= & gt; $ build_id,); Return View: Creating (' View ', $ Data);});  

And then on my thoughts:

  $ build = build :: find (build_id);  

But I get chaotic constant errors.

Any help on this?

Actually I can look at your code quickly and see two things:

< Ol>
  • When you type build_id build_id I think
  • You can create the build_id (no < Code> $ sign) Ie:
  • $ build = build :: find (build_id) ;

    should be:

    $ Build = Build :: Find ($ build_id);


    Comments

    Popular posts from this blog

    c# - SignalR: "Protocol error: Unknown transport." when navigating to hub -

    c# - WPF Expander overlay used in ItemsControl -

    class - Kivy: how to instantiate a dynamic classes in python -