This repository was archived by the owner on Apr 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweb.php
55 lines (45 loc) · 1.57 KB
/
web.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
/*
DB::listen(function ($query) {
dump($query->sql);
});
*/
Route::get('/', function () {
return view('welcome');
});
Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');
/*
Route::get('/user/{user}', function (\App\User $user) {
return $user;
});
*/
Route::get('/user/{user}', function (\App\User $user) {
return new \App\Http\Resources\UserResource($user);
});
Route::get('/topics', function () {
//return \App\Http\Resources\TopicResource::collection(\App\Topic::get());
//return new \App\Http\Resources\TopicCollection(\App\Topic::get());
//return \App\Http\Resources\TopicResource::collection(\App\Topic::paginate(3));
//return new \App\Http\Resources\TopicCollection(\App\Topic::paginate(3));
//return new \App\Http\Resources\TopicCollection(\App\Topic::get());
//return new \App\Http\Resources\TopicCollection(\App\Topic::with(['user', 'posts'])->get());
return new \App\Http\Resources\TopicCollection(\App\Topic::with(['user'])->get());
});
Route::get('/u', function () {
return (new \App\Http\Resources\UserResource(\App\User::find(1)))->additional([
'meta' => [
'token' => '123456789'
]
]);
});