function($reader) use ($data) {
public function __construct()
{
$this->middleware('auth');
$this->middleware(function ($request, $next) {
if(Gate::denies('VIEW_ADMIN')){
return redirect('myprofile');
}
return $next($request);
});
}
function name_should_not_be_too_long22()
{
$response = $this->post('/users', [
'name' => 'qwertgfdsazxcvbgtrewqasdfgbvcxzasdfgtrewqasdfgbvcxza',
'email' => 'ffffssff@yandex.ru',
'password' => 'secret',
]);
$response->assertSessionHasErrors([
'name' => 'The name may not be greater than 50 characters.'
]);
}
public function hasModel($relation)
{
return $this->$relation()->count()>0;
}
public function comments()
{
return $this->hasMany('App\Comment');
}
...
$this->hasModel('comments')
public function comments()
{
return $this->hasMany('App\Comment');
}
...
$this->has('comments')
public function testAccountAttach()
{
$response = $this->call('GET', route('accountattach',[
'id' => 1
]));
}
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwOlwvXC91cGxpZnkubG9jXC9hcGlcL2F1dGhcL3JlZ2lzdGVyIiwiaWF0IjoxNTM0NDkyMTE1LCJleHAiOjE1MzQ0OTU3MTUsIm5iZiI6MTUzNDQ5MjExNSwianRpIjoiMEx4VDA2eHo3bUlzd2p2MSIsInN1YiI6NCwicHJ2IjoiMGYwZWUyNTI0NTA0MGI3MTBkNTdhZmVjZDIxYTQyNDcyYWZiYzlhYSJ9.ZmnMvUIGTK5Y25-BmarkUI0chkZWhrvIjRbDmAu7QGk