Skip to content

Commit 521defb

Browse files
committed
Merge branch 'release/01_-_Débuter_avec_Laravel_6_-_Premiers_pas_avec_Eloquent_ORM_de_Laravel'
2 parents 3a3e9b8 + 3514de5 commit 521defb

25 files changed

+3425
-1014
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
5+
use Illuminate\Http\Request;
6+
use Illuminate\Support\Facades\View;
7+
8+
class AproposController extends Controller
9+
{
10+
public function index() {
11+
return View('apropos.index');
12+
}
13+
}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<?php
2+
3+
namespace App\Http\Controllers;
4+
5+
use App\Todo;
6+
use Illuminate\Http\Request;
7+
8+
class TodoController extends Controller
9+
{
10+
/**
11+
* Display a listing of the resource.
12+
*
13+
* @return \Illuminate\Http\Response
14+
*/
15+
public function index()
16+
{
17+
//
18+
$datas = Todo::all()->reject(function ($todo) {
19+
return $todo->done == 0;
20+
});
21+
22+
return view('todos.index', compact('datas'));
23+
24+
25+
}
26+
27+
/**
28+
* Show the form for creating a new resource.
29+
*
30+
* @return \Illuminate\Http\Response
31+
*/
32+
public function create()
33+
{
34+
//
35+
}
36+
37+
/**
38+
* Store a newly created resource in storage.
39+
*
40+
* @param \Illuminate\Http\Request $request
41+
* @return \Illuminate\Http\Response
42+
*/
43+
public function store(Request $request)
44+
{
45+
//
46+
}
47+
48+
/**
49+
* Display the specified resource.
50+
*
51+
* @param int $id
52+
* @return \Illuminate\Http\Response
53+
*/
54+
public function show($id)
55+
{
56+
//
57+
}
58+
59+
/**
60+
* Show the form for editing the specified resource.
61+
*
62+
* @param int $id
63+
* @return \Illuminate\Http\Response
64+
*/
65+
public function edit($id)
66+
{
67+
//
68+
}
69+
70+
/**
71+
* Update the specified resource in storage.
72+
*
73+
* @param \Illuminate\Http\Request $request
74+
* @param int $id
75+
* @return \Illuminate\Http\Response
76+
*/
77+
public function update(Request $request, $id)
78+
{
79+
//
80+
}
81+
82+
/**
83+
* Remove the specified resource from storage.
84+
*
85+
* @param int $id
86+
* @return \Illuminate\Http\Response
87+
*/
88+
public function destroy($id)
89+
{
90+
//
91+
}
92+
}

app/Providers/AuthServiceProvider.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,5 @@ class AuthServiceProvider extends ServiceProvider
2424
public function boot()
2525
{
2626
$this->registerPolicies();
27-
28-
//
2927
}
3028
}

app/Providers/EventServiceProvider.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,5 @@ public function boot()
2929
{
3030
parent::boot();
3131

32-
//
3332
}
3433
}

app/Providers/RouteServiceProvider.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public function map()
4646

4747
$this->mapWebRoutes();
4848

49-
//
5049
}
5150

5251
/**
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?php
2+
3+
namespace App\Providers;
4+
5+
use Illuminate\Support\Facades\Gate;
6+
use Laravel\Telescope\IncomingEntry;
7+
use Laravel\Telescope\Telescope;
8+
use Laravel\Telescope\TelescopeApplicationServiceProvider;
9+
10+
class TelescopeServiceProvider extends TelescopeApplicationServiceProvider
11+
{
12+
/**
13+
* Register any application services.
14+
*
15+
* @return void
16+
*/
17+
public function register()
18+
{
19+
// Telescope::night();
20+
21+
$this->hideSensitiveRequestDetails();
22+
23+
Telescope::filter(function (IncomingEntry $entry) {
24+
if ($this->app->environment('local')) {
25+
return true;
26+
}
27+
28+
return $entry->isReportableException() ||
29+
$entry->isFailedRequest() ||
30+
$entry->isFailedJob() ||
31+
$entry->isScheduledTask() ||
32+
$entry->hasMonitoredTag();
33+
});
34+
}
35+
36+
/**
37+
* Prevent sensitive request details from being logged by Telescope.
38+
*
39+
* @return void
40+
*/
41+
protected function hideSensitiveRequestDetails()
42+
{
43+
if ($this->app->environment('local')) {
44+
return;
45+
}
46+
47+
Telescope::hideRequestParameters(['_token']);
48+
49+
Telescope::hideRequestHeaders([
50+
'cookie',
51+
'x-csrf-token',
52+
'x-xsrf-token',
53+
]);
54+
}
55+
56+
/**
57+
* Register the Telescope gate.
58+
*
59+
* This gate determines who can access Telescope in non-local environments.
60+
*
61+
* @return void
62+
*/
63+
protected function gate()
64+
{
65+
Gate::define('viewTelescope', function ($user) {
66+
return in_array($user->email, [
67+
//
68+
]);
69+
});
70+
}
71+
}

app/Todo.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace App;
4+
5+
use Illuminate\Database\Eloquent\Model;
6+
7+
class Todo extends Model
8+
{
9+
protected $fillable = [
10+
'name', 'description', 'done'
11+
];
12+
}

app/User.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@ class User extends Authenticatable
1010
{
1111
use Notifiable;
1212

13-
/**
14-
* The attributes that are mass assignable.
15-
*
16-
* @var array
17-
*/
13+
/** @var array $fillable The attributes that are mass assignable */
1814
protected $fillable = [
1915
'name', 'email', 'password',
2016
];

composer.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"php": "^7.2",
1212
"fideloper/proxy": "^4.0",
1313
"laravel/framework": "^6.2",
14+
"laravel/telescope": "^3.1",
1415
"laravel/tinker": "^2.0",
1516
"laravel/ui": "^1.2"
1617
},
@@ -20,6 +21,7 @@
2021
"laravel/dusk": "^5.9",
2122
"mockery/mockery": "^1.0",
2223
"nunomaduro/collision": "^3.0",
24+
"nunomaduro/phpinsights": "^1.14",
2325
"phpunit/phpunit": "^8.0"
2426
},
2527
"config": {

0 commit comments

Comments
 (0)