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