fix me error
This commit is contained in:
@@ -20,6 +20,7 @@ use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use App\Models\Setting;
|
||||
use App\Http\Controllers\Admin\TahesabController;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
|
||||
//use App\Models\Price;
|
||||
@@ -30,8 +31,22 @@ class CustomerController extends Controller
|
||||
{
|
||||
public function me()
|
||||
{
|
||||
$select = ['*',Customer::$SELECT_CAJ,Customer::$SELECT_TYPE_STR];
|
||||
$user = Customer::with(['customer_settings.customer',"agent"])->select($select)->findOrFail(auth('customer')->id());
|
||||
$select = ['*', Customer::$SELECT_CAJ, Customer::$SELECT_TYPE_STR];
|
||||
|
||||
$with = [];
|
||||
if (Schema::hasTable('customers_settings')) {
|
||||
$with[] = 'customer_settings.customer';
|
||||
}
|
||||
if (Schema::hasColumn((new Customer)->getTable(), 'agent_id')) {
|
||||
$with[] = 'agent';
|
||||
}
|
||||
|
||||
$query = Customer::query();
|
||||
if ($with !== []) {
|
||||
$query->with($with);
|
||||
}
|
||||
|
||||
$user = $query->select($select)->findOrFail(auth('customer')->id());
|
||||
|
||||
$wallet = Wallet::where('owner', $user->id)
|
||||
->where('owner_type', $user->type)
|
||||
|
||||
Reference in New Issue
Block a user