NASER add settings to me api

This commit is contained in:
gholak tala
2026-01-31 09:09:32 +00:00
parent b6e8040d82
commit b7705c2c95
3 changed files with 99 additions and 1 deletions
@@ -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);
}