This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
Files
site-base/spark/src/Http/Controllers/Kiosk/ProfileController.php
2017-11-03 16:26:07 +11:00

51 lines
1.2 KiB
PHP

<?php
namespace Laravel\Spark\Http\Controllers\Kiosk;
use Laravel\Spark\Spark;
use Illuminate\Http\Request;
use Laravel\Spark\Http\Controllers\Controller;
use Laravel\Spark\Contracts\Repositories\UserRepository;
use Laravel\Spark\Contracts\Repositories\PerformanceIndicatorsRepository;
class ProfileController extends Controller
{
/**
* The performance indicators repository instance.
*
* @var PerformanceIndicatorsRepository
*/
protected $indicators;
/**
* Create a new controller instance.
*
* @param PerformanceIndicatorsRepository $indicators
* @return void
*/
public function __construct(PerformanceIndicatorsRepository $indicators)
{
$this->indicators = $indicators;
$this->middleware('auth');
$this->middleware('dev');
}
/**
* Get the user to be displayed on the user profile screen.
*
* @param Request $request
* @param string $id
* @return Response
*/
public function show(Request $request, $id)
{
$user = Spark::call(UserRepository::class.'@find', [$id]);
return response()->json([
'user' => $user,
'revenue' => $this->indicators->totalRevenueForUser($user),
]);
}
}