Declare sharable user instance in master view
This commit is contained in:
parent
c57a8c8316
commit
d9efa1d5ff
|
|
@ -14,7 +14,6 @@ class ClosetController extends Controller
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
return view('user.closet')
|
return view('user.closet')
|
||||||
->with('user', Auth::user())
|
|
||||||
->with('extra', ['unverified' => option('require_verification') && ! $user->verified]);
|
->with('extra', ['unverified' => option('require_verification') && ! $user->verified]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -52,11 +52,7 @@ class PlayerController extends Controller
|
||||||
|
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$user = Auth::user();
|
|
||||||
|
|
||||||
return view('user.player')
|
return view('user.player')
|
||||||
->with('players', $user->players->toArray())
|
|
||||||
->with('user', $user)
|
|
||||||
->with('extra', [
|
->with('extra', [
|
||||||
'rule' => trans('user.player.player-name-rule.'.option('player_name_rule')),
|
'rule' => trans('user.player.player-name-rule.'.option('player_name_rule')),
|
||||||
'length' => trans(
|
'length' => trans(
|
||||||
|
|
|
||||||
|
|
@ -40,11 +40,6 @@ class ReportController extends Controller
|
||||||
return json(trans('skinlib.report.success'), 0);
|
return json(trans('skinlib.report.success'), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function viewTrack()
|
|
||||||
{
|
|
||||||
return view('user.report', ['user' => auth()->user()]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function track()
|
public function track()
|
||||||
{
|
{
|
||||||
return Report::where('reporter', auth()->id())
|
return Report::where('reporter', auth()->id())
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@ class UserController extends Controller
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
|
|
||||||
return view('user.index')->with([
|
return view('user.index')->with([
|
||||||
'user' => $user,
|
|
||||||
'statistics' => [
|
'statistics' => [
|
||||||
'players' => $this->calculatePercentageUsed($user->players->count(), option('score_per_player')),
|
'players' => $this->calculatePercentageUsed($user->players->count(), option('score_per_player')),
|
||||||
'storage' => $this->calculatePercentageUsed($user->getStorageUsed(), option('score_per_storage')),
|
'storage' => $this->calculatePercentageUsed($user->getStorageUsed(), option('score_per_storage')),
|
||||||
|
|
@ -160,7 +159,6 @@ class UserController extends Controller
|
||||||
{
|
{
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
return view('user.profile')
|
return view('user.profile')
|
||||||
->with('user', $user)
|
|
||||||
->with('extra', [
|
->with('extra', [
|
||||||
'unverified' => option('require_verification') && ! $user->verified,
|
'unverified' => option('require_verification') && ! $user->verified,
|
||||||
'admin' => $user->isAdmin(),
|
'admin' => $user->isAdmin(),
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,10 @@
|
||||||
@yield('style')
|
@yield('style')
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
@php
|
||||||
|
$user = auth()->user();
|
||||||
|
@endphp
|
||||||
|
|
||||||
<body class="hold-transition {{ option('color_scheme') }} sidebar-mini">
|
<body class="hold-transition {{ option('color_scheme') }} sidebar-mini">
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ Route::group([
|
||||||
Route::get('/score-info', 'UserController@scoreInfo');
|
Route::get('/score-info', 'UserController@scoreInfo');
|
||||||
Route::post('/sign', 'UserController@sign');
|
Route::post('/sign', 'UserController@sign');
|
||||||
|
|
||||||
Route::get('/reports', 'ReportController@viewTrack');
|
Route::view('/reports', 'user.report');
|
||||||
Route::get('/report-list', 'ReportController@track');
|
Route::get('/report-list', 'ReportController@track');
|
||||||
|
|
||||||
// Profile
|
// Profile
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ class ClosetControllerTest extends TestCase
|
||||||
|
|
||||||
public function testIndex()
|
public function testIndex()
|
||||||
{
|
{
|
||||||
$this->get('/user/closet')->assertViewHas('user');
|
$this->get('/user/closet')->assertViewIs('user.closet');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testGetClosetData()
|
public function testGetClosetData()
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,7 @@ class PlayerControllerTest extends TestCase
|
||||||
|
|
||||||
public function testIndex()
|
public function testIndex()
|
||||||
{
|
{
|
||||||
$this->get('/user/player?pid=5')
|
$this->get('/user/player?pid=5')->assertViewIs('user.player');
|
||||||
->assertViewHas('players')
|
|
||||||
->assertViewHas('user');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testListAll()
|
public function testListAll()
|
||||||
|
|
|
||||||
|
|
@ -71,12 +71,6 @@ class ReportControllerTest extends TestCase
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testViewTrack()
|
|
||||||
{
|
|
||||||
$user = factory(User::class)->create();
|
|
||||||
$this->actAs($user)->get('/user/reports')->assertViewIs('user.report');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testTrack()
|
public function testTrack()
|
||||||
{
|
{
|
||||||
$user = factory(User::class)->create();
|
$user = factory(User::class)->create();
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ class UserControllerTest extends TestCase
|
||||||
|
|
||||||
$this->actAs($user)
|
$this->actAs($user)
|
||||||
->get('/user')
|
->get('/user')
|
||||||
->assertViewHas('user')
|
|
||||||
->assertViewHas('statistics')
|
->assertViewHas('statistics')
|
||||||
->assertSee((new Parsedown())->text(option_localized('announcement')))
|
->assertSee((new Parsedown())->text(option_localized('announcement')))
|
||||||
->assertSee((string) $user->score);
|
->assertSee((string) $user->score);
|
||||||
|
|
@ -200,9 +199,7 @@ class UserControllerTest extends TestCase
|
||||||
|
|
||||||
public function testProfile()
|
public function testProfile()
|
||||||
{
|
{
|
||||||
$this->actAs('normal')
|
$this->actAs('normal')->get('/user/profile')->assertViewIs('user.profile');
|
||||||
->get('/user/profile')
|
|
||||||
->assertViewHas('user');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testHandleProfile()
|
public function testHandleProfile()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user