Support the ongoing development of Laravel.io →
Requests Database Eloquent
Last updated 2 years ago.
0

in routes can be retrieve

Route::get('', function() {

return User::all();

});

this reuslt [{"id":2,"name":"amman","number":4567889,"location":"aaaa","phone":125454},{"id":3,"name":"amman","number":4567889,"location":"aaaa","phone":125454},{"id":4,"name":"aaaa","number":0,"location":"aaaa","phone":0},{"id":5,"name":"aaaaaaaa","number":2147483647,"location":"aaaaaa","phone":100000000},{"id":6,"name":"\u0634\u0634\u0634\u0634","number":14545454,"location":"\u0628\u0644\u0628\u0644\u0628\u0644\u0628\u0644\u0628","phone":5455454},{"id":7,"name":"aaaa","number":0,"location":"aaa","phone":0},{"id":8,"name":"mohammad","number":766354353,"location":"aaaa","phone":25536563},{"id":9,"name":"mohammad","number":1235464,"location":"aaaaa","phone":2147483647},{"id":10,"name":"aaaaaaaaaaaaa","number":12121,"location":"aaaa","phone":1212121},{"id":11,"name":"mohammad","number":0,"location":"aaa","phone":0}]

how can be retrieve previous data in table?

Last updated 2 years ago.
0
Solution

Its Json what you posted is used for creating ajax requests so you have to do it with ajax and use json or render some view and use array.

// routes.php
Route::get("/", function()
{
	
	$users = User::all();

	return View::make("users")->with("allUsers", $users);

});



// views/users.blade.php

<table>
	<tr>
		<td>ID</td>
		<td>Name</td>
	</tr>

	@foreach($allUsers as $usr)

		<tr>
			<td>{{ $usr->id }}</td>
			<td>{{ $usr->name }}</td>
		</tr>

	@endforeach
</table>
Last updated 2 years ago.
0

Thanks a lot nipid

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.