Laravel CRUD: Fetch & Display Data using Resource Controller with Eloquent Model | CRUD in Laravel

Laravel CRUD: Fetch & Display Data using Resource Controller with Eloquent Model | CRUD in Laravel

WebStack

4 года назад

1,898 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@techtalks357
@techtalks357 - 25.07.2021 14:27

very useful and helpful video thanks

Ответить
@gamnguyen3116
@gamnguyen3116 - 07.03.2021 06:52

Could you help me out, please!
I have TWO TABLES with relationship.
In my index method, I join them and compact the $real .
$real = DB::table('declarers')
->join ('estates','declarers.id','estates.item_id')
->get();

In my index view, I loop through the $real: @foreach ($real as $pr) and manage to display the data.

However, problem occurs with the Show button <a class="btn btn-info" href="{{ route('products.show',$pr->id) }}">Show</a>
As, this takes the ID of ONE TABLE only (the estates table).
And thus, in show method +show view, I can only display the information from the estates table.
What should I do to display the corresponding information from the declarers too?

I am looking forward to your advice, and thank you in advance!

Ответить
@saranrajn
@saranrajn - 22.05.2020 08:50

Madam, i want to set a column name (p_id) instead of (id) what to do?

Ответить
@niharikasharma6964
@niharikasharma6964 - 11.04.2020 11:41

mam in my case when the show function is running ,id is displayed on the URL when I m writing /studentresource/{{$n->id}} in the href,also the show function is being called (I have checked by returning a simple text ) but when I m returning the parameter I.e Student $student as return $student ,it is displaying an empty array.

Ответить