2018-07-17 04:10:40 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
2021-10-01 04:59:04 +00:00
|
|
|
use Illuminate\Http\Request;
|
|
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
|
|
|
|
use App\Models\Account;
|
2018-07-17 04:10:40 +00:00
|
|
|
|
|
|
|
class ResellerServicesController extends Controller
|
|
|
|
{
|
2018-08-08 23:33:51 +00:00
|
|
|
public function accounts()
|
|
|
|
{
|
|
|
|
return ['data'=>Auth::user()->all_accounts()->values()];
|
|
|
|
}
|
|
|
|
|
2018-07-17 04:10:40 +00:00
|
|
|
public function agents()
|
|
|
|
{
|
|
|
|
return ['data'=>Auth::user()->all_agents()->values()];
|
|
|
|
}
|
|
|
|
|
2018-08-08 23:33:51 +00:00
|
|
|
public function clients()
|
2018-07-17 04:10:40 +00:00
|
|
|
{
|
2018-08-08 23:33:51 +00:00
|
|
|
return ['data'=>Auth::user()->all_clients()->values()];
|
2018-07-17 04:10:40 +00:00
|
|
|
}
|
2018-08-11 05:09:41 +00:00
|
|
|
|
2021-10-01 04:59:04 +00:00
|
|
|
public function services(Request $request,Account $o)
|
|
|
|
{
|
|
|
|
return $o->services
|
|
|
|
->filter(function($item) use ($request) {
|
|
|
|
return $item->active || ($item->id == $request->include);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2018-11-21 02:46:16 +00:00
|
|
|
public function service_inactive()
|
|
|
|
{
|
|
|
|
return ['data'=>Auth::user()->all_client_service_inactive()->values()];
|
|
|
|
}
|
2018-07-17 04:10:40 +00:00
|
|
|
}
|