mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-12-27 06:29:19 +08:00
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()
|
||||
{
|
||||
return view('user.closet')
|
||||
->with('user', Auth::user())
|
||||
->with('extra', ['unverified' => option('require_verification') && ! $user->verified]);
|
||||
}
|
||||
|
||||
|
@ -52,11 +52,7 @@ class PlayerController extends Controller
|
||||
|
||||
public function index()
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
return view('user.player')
|
||||
->with('players', $user->players->toArray())
|
||||
->with('user', $user)
|
||||
->with('extra', [
|
||||
'rule' => trans('user.player.player-name-rule.'.option('player_name_rule')),
|
||||
'length' => trans(
|
||||
|
@ -40,11 +40,6 @@ class ReportController extends Controller
|
||||
return json(trans('skinlib.report.success'), 0);
|
||||
}
|
||||
|
||||
public function viewTrack()
|
||||
{
|
||||
return view('user.report', ['user' => auth()->user()]);
|
||||
}
|
||||
|
||||
public function track()
|
||||
{
|
||||
return Report::where('reporter', auth()->id())
|
||||
|
@ -32,7 +32,6 @@ class UserController extends Controller
|
||||
$user = Auth::user();
|
||||
|
||||
return view('user.index')->with([
|
||||
'user' => $user,
|
||||
'statistics' => [
|
||||
'players' => $this->calculatePercentageUsed($user->players->count(), option('score_per_player')),
|
||||
'storage' => $this->calculatePercentageUsed($user->getStorageUsed(), option('score_per_storage')),
|
||||
@ -160,7 +159,6 @@ class UserController extends Controller
|
||||
{
|
||||
$user = Auth::user();
|
||||
return view('user.profile')
|
||||
->with('user', $user)
|
||||
->with('extra', [
|
||||
'unverified' => option('require_verification') && ! $user->verified,
|
||||
'admin' => $user->isAdmin(),
|
||||
|
@ -14,6 +14,10 @@
|
||||
@yield('style')
|
||||
</head>
|
||||
|
||||
@php
|
||||
$user = auth()->user();
|
||||
@endphp
|
||||
|
||||
<body class="hold-transition {{ option('color_scheme') }} sidebar-mini">
|
||||
<div class="wrapper">
|
||||
|
||||
|
@ -49,7 +49,7 @@ Route::group([
|
||||
Route::get('/score-info', 'UserController@scoreInfo');
|
||||
Route::post('/sign', 'UserController@sign');
|
||||
|
||||
Route::get('/reports', 'ReportController@viewTrack');
|
||||
Route::view('/reports', 'user.report');
|
||||
Route::get('/report-list', 'ReportController@track');
|
||||
|
||||
// Profile
|
||||
|
@ -24,7 +24,7 @@ class ClosetControllerTest extends TestCase
|
||||
|
||||
public function testIndex()
|
||||
{
|
||||
$this->get('/user/closet')->assertViewHas('user');
|
||||
$this->get('/user/closet')->assertViewIs('user.closet');
|
||||
}
|
||||
|
||||
public function testGetClosetData()
|
||||
|
@ -21,9 +21,7 @@ class PlayerControllerTest extends TestCase
|
||||
|
||||
public function testIndex()
|
||||
{
|
||||
$this->get('/user/player?pid=5')
|
||||
->assertViewHas('players')
|
||||
->assertViewHas('user');
|
||||
$this->get('/user/player?pid=5')->assertViewIs('user.player');
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
$user = factory(User::class)->create();
|
||||
|
@ -21,7 +21,6 @@ class UserControllerTest extends TestCase
|
||||
|
||||
$this->actAs($user)
|
||||
->get('/user')
|
||||
->assertViewHas('user')
|
||||
->assertViewHas('statistics')
|
||||
->assertSee((new Parsedown())->text(option_localized('announcement')))
|
||||
->assertSee((string) $user->score);
|
||||
@ -200,9 +199,7 @@ class UserControllerTest extends TestCase
|
||||
|
||||
public function testProfile()
|
||||
{
|
||||
$this->actAs('normal')
|
||||
->get('/user/profile')
|
||||
->assertViewHas('user');
|
||||
$this->actAs('normal')->get('/user/profile')->assertViewIs('user.profile');
|
||||
}
|
||||
|
||||
public function testHandleProfile()
|
||||
|
Loading…
Reference in New Issue
Block a user