0
I’m doing an app on Laravel 5.4 that the administrator modifies various information of a particular client.
Example: in the customer listing is clicked on Modules
The user is directing to another page, which is environment that will list, modify, etc. All information of each module of this client.
But my problem is that I’m having to pass the ID
of the client on all pages, by URL.
Example:
admin/modules/1/financial/data '1' is the client ID.
Or
admin/modules/1/supplier/data '1' is the client ID.
I was going to try to use the Service Container of Larable, but I could not understand how to do this in my application.
Could I explain the last part more clearly? it is worth remembering that it is normal to make so clear it will depend on a better context, but, if you can clarify the last part !!!
– novic
I would like to pass the parameter a single time, like when I will open the page of a module I have to take the parameter of the client ID, this will occur on all pages of the modules. I read something about English, but I couldn’t understand how to implement it.
– Jean Prado
Let’s see if I understand, that tab you click and pass one after the other with an address ? and at that address is loaded the page again and has that id that so bothers you to be passed?
– novic
that! equal admin/modules/1/financial is a module admin/modules/1/supplier another module, each is a different tab.
– Jean Prado
is just like this has no better form, you will create a Singleton so that, if you will create a session or a cookie for that, if the element in the url already satisfies you and does not consume resources. in my experience it’s just like that ...
– novic
Why don’t you improve the interface and load this information right away?
– novic
I thought about doing this, but there are many modules, the page will be huge, and take a long time to load
– Jean Prado
I thought there would be another way to do this, without having to pass the ID parameter all the time in the URL
– Jean Prado
Got it man ... well I guess it’s not necessary to do something different ... but, I don’t know! each one has their own experience and opinion ...
– novic
Okay! Thanks anyway. I think I’ll continue the same way I’m doing anyway!
– Jean Prado
Show how is the route you are setting, and the controller method.
– Elias Soares
route
Route::get('{cid}/financeiro', ['as' => 'financial.index', 'uses' => 'MfinancialController@index']);
– Jean Prado
Controller
public function index($cid)
 {
 $client = $this->userRepository->find($cid);

 return view('admin.modules.financial.index', compact('client'));
 }
– Jean Prado