NASER add settings to me api
This commit is contained in:
@@ -17,6 +17,7 @@ use Rooyesh\Wallet\models\Wallet;
|
||||
use Rooyesh\Wallet\models\Transaction;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use App\Models\Setting;
|
||||
|
||||
|
||||
//use App\Models\Price;
|
||||
@@ -27,7 +28,8 @@ class CustomerController extends Controller
|
||||
{
|
||||
public function me()
|
||||
{
|
||||
$user = Customer::findOrFail(auth('customer')->id());
|
||||
$select = ['*',Customer::$SELECT_CAJ,Customer::$SELECT_TYPE_STR];
|
||||
$user = Customer::with(['customer_settings.customer',"agent"])->select($select)->findOrFail(auth('customer')->id());
|
||||
|
||||
$wallet = Wallet::where('owner', $user->id)
|
||||
->where('owner_type', $user->type)
|
||||
@@ -75,6 +77,14 @@ class CustomerController extends Controller
|
||||
->whereNotNull('product_id') // Filters wallets that have a non-null product_id
|
||||
->get() ?? new Wallet(); // If no wallet is found, assigns a new Wallet instance to the attribute
|
||||
|
||||
$forbiddenWords = ['tahesab', 'token']; // کلمات ممنوعه
|
||||
$query = Setting::query();
|
||||
// حذف رکوردهایی که key شامل کلمات ممنوعه است
|
||||
foreach ($forbiddenWords as $word) {
|
||||
$query->where('key', 'not like', "%{$word}%");
|
||||
}$settings = $query->get();
|
||||
$user->settings= $settings;
|
||||
|
||||
return response()->json($user);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user