Settings basics
This commit is contained in:
24
app/Http/Controllers/SettingsController.php
Normal file
24
app/Http/Controllers/SettingsController.php
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Settings;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class SettingsController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display a listing of the resource.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
return Settings::all();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get($setting)
|
||||||
|
{
|
||||||
|
return Settings::get($setting);
|
||||||
|
}
|
||||||
|
}
|
||||||
40
app/Models/Settings.php
Normal file
40
app/Models/Settings.php
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Settings extends Model
|
||||||
|
{
|
||||||
|
use HasFactory;
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $table = 'c_settings';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary key associated with the table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $primaryKey = 'name';
|
||||||
|
/**
|
||||||
|
* Indicates if the model's ID is auto-incrementing.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $incrementing = false;
|
||||||
|
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
|
protected function get($name = null)
|
||||||
|
{
|
||||||
|
return $this->where('name',$name)->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -30,6 +30,7 @@ const sdropdown = ref([
|
|||||||
const products = ref([]);
|
const products = ref([]);
|
||||||
const searchField = ref('descLong');
|
const searchField = ref('descLong');
|
||||||
const searchValue = ref('');
|
const searchValue = ref('');
|
||||||
|
const settings = ref({});
|
||||||
|
|
||||||
const countryHash = ref([]);
|
const countryHash = ref([]);
|
||||||
const countryCurrency = ref({});
|
const countryCurrency = ref({});
|
||||||
@@ -222,6 +223,9 @@ const fetch = async () => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
console.log("TEST=", ccountry_filter.value, ccountry_list.value);
|
console.log("TEST=", ccountry_filter.value, ccountry_list.value);
|
||||||
|
const response2 = await axios.get(route("settings"));
|
||||||
|
settings.value = response2.data;
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const response = await Swal.fire({
|
const response = await Swal.fire({
|
||||||
title: __("are you want to try again") + "?",
|
title: __("are you want to try again") + "?",
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ use App\Http\Controllers\GeoIPController;
|
|||||||
use App\Http\Controllers\IkeaProductsController;
|
use App\Http\Controllers\IkeaProductsController;
|
||||||
use App\Http\Controllers\ProductsCompareController;
|
use App\Http\Controllers\ProductsCompareController;
|
||||||
use App\Http\Controllers\FeedbackController;
|
use App\Http\Controllers\FeedbackController;
|
||||||
|
use App\Http\Controllers\SettingsController;
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Web Routes
|
| Web Routes
|
||||||
@@ -35,6 +35,7 @@ Route::post('users-send-email', [FeedbackController::class, 'sendEmail'])->name(
|
|||||||
Route::get('/menu/get', [App\Http\Controllers\Superuser\UserMenuController::class, 'get'])->name('menu.user');
|
Route::get('/menu/get', [App\Http\Controllers\Superuser\UserMenuController::class, 'get'])->name('menu.user');
|
||||||
Route::get('/ip/get/{ip?}', [GeoIPController::class, 'index'])->name('geo.ip.get');
|
Route::get('/ip/get/{ip?}', [GeoIPController::class, 'index'])->name('geo.ip.get');
|
||||||
Route::get('/ccountry/', [CountryCodeController::class, 'index'])->name('ccountry.index');
|
Route::get('/ccountry/', [CountryCodeController::class, 'index'])->name('ccountry.index');
|
||||||
|
Route::get('/settings/', [SettingsController::class, 'index'])->name('ccountry.index');
|
||||||
Route::get('/ccountry/codes/', [CountryCodeController::class, 'codes'])->name('ccountry.codes');
|
Route::get('/ccountry/codes/', [CountryCodeController::class, 'codes'])->name('ccountry.codes');
|
||||||
Route::get('/ccountry/active/', [CountryCodeController::class, 'active'])->name('ccountry.active');
|
Route::get('/ccountry/active/', [CountryCodeController::class, 'active'])->name('ccountry.active');
|
||||||
Route::get('/search/{id}',[CountryCompareController::class,'search'])->name('ccompare.search');
|
Route::get('/search/{id}',[CountryCompareController::class,'search'])->name('ccompare.search');
|
||||||
|
|||||||
Reference in New Issue
Block a user