apis
This commit is contained in:
parent
e351b69f7f
commit
9dacdd3557
|
|
@ -57,9 +57,9 @@ return [
|
||||||
'engine' => 'InnoDB',
|
'engine' => 'InnoDB',
|
||||||
'host' => 'localhost',
|
'host' => 'localhost',
|
||||||
'port' => 3306,
|
'port' => 3306,
|
||||||
'database' => 'sapaly_git',
|
'database' => 'sapaly_october',
|
||||||
'username' => 'root',
|
'username' => 'sapaly',
|
||||||
'password' => '',
|
'password' => '22MOcP6^I#8tI5ovcXluXDT#%vWC^CtsFvKHOygi8TMnzaMuLYx@123',
|
||||||
'charset' => 'utf8mb4',
|
'charset' => 'utf8mb4',
|
||||||
'collation' => 'utf8mb4_unicode_ci',
|
'collation' => 'utf8mb4_unicode_ci',
|
||||||
'prefix' => '',
|
'prefix' => '',
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,8 @@ class CategoriesAPIController extends Controller
|
||||||
->select("id", "name", "slug")
|
->select("id", "name", "slug")
|
||||||
->orderBy("nest_left", "asc")
|
->orderBy("nest_left", "asc")
|
||||||
->with('translations:locale,model_id,attribute_data')
|
->with('translations:locale,model_id,attribute_data')
|
||||||
|
->with('icon')
|
||||||
|
->with('preview_image')
|
||||||
->where("nest_depth", 0)
|
->where("nest_depth", 0)
|
||||||
->active()
|
->active()
|
||||||
->get();
|
->get();
|
||||||
|
|
@ -39,6 +41,8 @@ class CategoriesAPIController extends Controller
|
||||||
->select("id", "name", "slug")
|
->select("id", "name", "slug")
|
||||||
->orderBy("nest_left", "asc")
|
->orderBy("nest_left", "asc")
|
||||||
->with('translations:locale,model_id,attribute_data')
|
->with('translations:locale,model_id,attribute_data')
|
||||||
|
->with('icon')
|
||||||
|
->with('preview_image')
|
||||||
->where("parent_id", $id)
|
->where("parent_id", $id)
|
||||||
->active()
|
->active()
|
||||||
->get();
|
->get();
|
||||||
|
|
|
||||||
|
|
@ -23,11 +23,17 @@ class ProductAPIController extends Controller
|
||||||
public function index(){
|
public function index(){
|
||||||
|
|
||||||
$data = $this->Product
|
$data = $this->Product
|
||||||
->select("id", "name", "slug", "category_id", "featured")
|
->select("id", "name", "slug", "category_id", "featured", "description")
|
||||||
->with('translations:locale,model_id,attribute_data')
|
//->with(['preview_image' => function ($query) {
|
||||||
// ->with(['category' => function ($query) {
|
// $query->select("id", "path");
|
||||||
// $query->with('translations:locale,model_id,attribute_data');
|
|
||||||
// }])
|
// }])
|
||||||
|
->with('preview_image')
|
||||||
|
//->with('offer:id,main_price')
|
||||||
|
//->with('images')
|
||||||
|
->with('translations:locale,model_id,attribute_data')
|
||||||
|
->with(['offer' => function ($query) {
|
||||||
|
$query->with('main_price');
|
||||||
|
}])
|
||||||
->active()
|
->active()
|
||||||
->paginate(10);
|
->paginate(10);
|
||||||
|
|
||||||
|
|
@ -44,8 +50,12 @@ class ProductAPIController extends Controller
|
||||||
|
|
||||||
$data = $this->Product
|
$data = $this->Product
|
||||||
->select("id", "name", "slug", "category_id", "featured")
|
->select("id", "name", "slug", "category_id", "featured")
|
||||||
|
->with('preview_image')
|
||||||
->with('translations:locale,model_id,attribute_data')
|
->with('translations:locale,model_id,attribute_data')
|
||||||
->where("category_id", $id)
|
->where("category_id", $id)
|
||||||
|
->with(['offer' => function ($query) {
|
||||||
|
$query->with('main_price');
|
||||||
|
}])
|
||||||
->active()
|
->active()
|
||||||
->paginate(10);
|
->paginate(10);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
use Cms\Classes\Controller;
|
use Cms\Classes\Controller;
|
||||||
use BackendMenu;
|
use BackendMenu;
|
||||||
|
use Config;
|
||||||
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use AhmadFatoni\ApiGenerator\Helpers\Helpers;
|
use AhmadFatoni\ApiGenerator\Helpers\Helpers;
|
||||||
|
|
@ -21,6 +22,7 @@ class SliderAPIController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
public function index(){
|
public function index(){
|
||||||
|
$path = Config::get('app.cdn').Config::get('cms.storage.media.path');
|
||||||
|
|
||||||
$data = $this->Slider
|
$data = $this->Slider
|
||||||
->select("id", "img")
|
->select("id", "img")
|
||||||
|
|
@ -29,7 +31,7 @@ class SliderAPIController extends Controller
|
||||||
|
|
||||||
if($data) {
|
if($data) {
|
||||||
$data->each(function ($item, $key) {
|
$data->each(function ($item, $key) {
|
||||||
$item->img = $this->pageUrl('index') . \Config::get('cms.storage.media.path') . $item->img;
|
$item->img = "http://sapalymahabat.com.tm" . \Config::get('cms.storage.media.path') . $item->img;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,10 +16,10 @@ Route::group(['prefix' =>'api/v1','namespace' =>'AhmadFatoni\ApiGenerator\Contro
|
||||||
Route::get('sliders', 'SliderAPIController@index');
|
Route::get('sliders', 'SliderAPIController@index');
|
||||||
|
|
||||||
|
|
||||||
Route::middleware([\ReaZzon\JWTAuth\Http\Middlewares\ResolveUser::class])->group(function () {
|
//Route::middleware([\ReaZzon\JWTAuth\Http\Middlewares\ResolveUser::class])->group(function () {
|
||||||
|
|
||||||
Route::get('cart', 'CartAPIController@index');
|
//Route::get('cart', 'CartAPIController@index');
|
||||||
|
|
||||||
});
|
// });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue