laravel - routing forms and related models -


This is an initial question how to set up a route and controller for a simple management system in Laravel 4.2.

Let's say I have a 'person' model ('name' and 'email'). I also have a 'book' model which is' person '(' title 'and' author ',' person_id ').

To create a new person, the form of the form is as follows:

For example

As a way to add a new book to a person:

example.com/persons/22/books/create

Currently my Routes are set as follows:

  Root :: Resources ('Individuals', 'Person Controller'); Root :: Resources ('Books', 'Books Controller');  

The function of my person's model is:

  public functions books () {return $ this-> Hammamen ('book'); }  

The functions in my book model are:

  public function person () {return $ this- & gt; Affiliation ('person'); }  

Where have I gone wrong? What is it?

From:

"nest" resource controller, your route announcement Use "dot" notation in

  Root :: resources ('persons.books', 'BooksController');  

To get the list of registered path paths, you can use the console command php artisan routes

Are

Comments

Popular posts from this blog

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

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

python - mayavi mapping a discrete colorbar on a surface -