MINI Sh3ll
<?php
namespace App\Solar\Repositories\Panel;
use App\Models\Panel;
class PanelRepository implements PanelInterface
{
/**
* @var Panel
*/
private $panel;
/**
* PanelRepository constructor.
* @param Panel $panel
*/
public function __construct(Panel $panel) {
$this->panel = $panel;
}
/*
* Listing panel store for company
*/
public function getPanelList($request) {
$query = $this->panel->query();
//Checked auth user role,if role not superadmin listing according to company
//dd(\Auth::user()->roles->id);
if(\Auth::user()->roles->id == config('constants.role.superadmin.id') || \Auth::user()->roles->id == config('constants.role.scpl_user.id')){
$query = $query->with('register_api','company');
} else {
$company_id = \Auth::user()->company_users->pluck('company_id')->all();
$query = $query->with('register_api','company')->whereIn('company_id', $company_id);
}
$query = $query->orderBy('id', 'DESC')->get();
return $query;
}
/*
* Store panel details
*/
public function storePanel($req) {
}
/*
* Get perticular Panel details
*/
public function paneldetails($id) {
return $this->panel->with('register_api','company')->findOrFail(decrypt($id));
}
/*
* Edit panel details
*/
public function editPanel($req) {
}
/*
* Delete panel details
*/
public function deletePanel($id) {
$panel = $this->panel->findOrFail($id);
$panel->delete();
return $panel;
}
}
OHA YOOOO