fix: show & auth user with littlelink_name

This commit is contained in:
Khashayar Zavosh 2021-04-18 22:13:43 +04:30
parent 93e2d1039d
commit bfeddce3ba
5 changed files with 10 additions and 11 deletions

View File

@ -20,8 +20,7 @@ class AdminController extends Controller
public function index()
{
$userId = Auth::user()->id;
$name = Auth::user()->name;
$littlelink_name = Auth::user()->littlelink_name;
$links = Link::where('user_id', $userId)->select('link')->count();
$clicks = Link::where('user_id', $userId)->sum('click_number');
@ -29,7 +28,7 @@ class AdminController extends Controller
$siteLinks = Link::count();
$siteClicks = Link::sum('click_number');
return view('panel/index', ['name' => $name, 'links' => $links, 'clicks' => $clicks, 'siteLinks' => $siteLinks, 'siteClicks' => $siteClicks, 'userNumber' => $userNumber]);
return view('panel/index', ['littlelink_name' => $littlelink_name, 'links' => $links, 'clicks' => $clicks, 'siteLinks' => $siteLinks, 'siteClicks' => $siteClicks, 'userNumber' => $userNumber]);
}
//Get users by type
@ -110,7 +109,7 @@ class AdminController extends Controller
User::where('id', $id)->update(['name' => $name, 'email' => $email, 'password' => $password, 'littlelink_name' => $littlelink_name, 'littlelink_description' => $littlelink_description, 'role' => $role]);
if(!empty($profilePhoto)){
$profilePhoto->move(public_path('/img'), $name . ".png");
$profilePhoto->move(public_path('/img'), $littlelink_name . ".png");
}
return back();

View File

@ -21,13 +21,13 @@ class UserController extends Controller
{
$userId = Auth::user()->id;
$name = Auth::user()->name;
$littlelink_name = Auth::user()->littlelink_name;
$links = Link::where('user_id', $userId)->select('link')->count();
$clicks = Link::where('user_id', $userId)->sum('click_number');
return view('studio/index', ['name' => $name, 'links' => $links, 'clicks' => $clicks]);
return view('studio/index', ['littlelink_name' => $littlelink_name, 'links' => $links, 'clicks' => $clicks]);
}
//Show littlelink page. example => http://127.0.0.1:8000/+admin
@ -175,7 +175,7 @@ class UserController extends Controller
public function editPage(request $request)
{
$userId = Auth::user()->id;
$username = Auth::user()->name;
$littlelink_name = Auth::user()->littlelink_name;
$profilePhoto = $request->file('image');
$pageName = $request->pageName;
@ -184,7 +184,7 @@ class UserController extends Controller
User::where('id', $userId)->update(['littlelink_name' => $pageName, 'littlelink_description' => $pageDescription]);
if(!empty($profilePhoto)){
$profilePhoto->move(public_path('/img'), $username . ".png");
$profilePhoto->move(public_path('/img'), $littlelink_name . ".png");
}
return back();

View File

@ -2,7 +2,7 @@
@section('content')
<h2 class="mb-4"> 👋 Hi {{ $name }}</h2>
<h2 class="mb-4"> 👋 Hi {{ $littlelink_name }}</h2>
<p>
Wellcome to littlelink. You are ready to raise links?! 😉

View File

@ -2,7 +2,7 @@
@section('content')
<h2 class="mb-4"> 👋 Hi {{ $name }}</h2>
<h2 class="mb-4"> 👋 Hi {{ $littlelink_name }}</h2>
<p>
Wellcome to littlelink. You are ready to raise links?! 😉

View File

@ -8,7 +8,7 @@
@csrf
@foreach($profile as $profile)
<div class="form-group col-lg-8">
<label>name</label>
<label>Username</label>
<input type="text" class="form-control" name="name" value="{{ $profile->name }}">
</div>
<div class="form-group col-lg-8">