from server
This commit is contained in:
parent
77c27f4b5f
commit
5a985dc5dd
|
|
@ -11,6 +11,7 @@ use Illuminate\Support\Facades\Validator;
|
|||
use RainLab\Blog\Models\Post;
|
||||
use TPS\Birzha\Classes\BlogPostResource;
|
||||
use TPS\Birzha\Models\SliderApp;
|
||||
use RainLab\User\Models\User;
|
||||
|
||||
class BlogPostsApiController extends Controller
|
||||
{
|
||||
|
|
@ -44,6 +45,28 @@ class BlogPostsApiController extends Controller
|
|||
->paginate($data['per_page'] ?? 7))->response()->getData(), 200);
|
||||
}
|
||||
|
||||
|
||||
public function getAccounts(Request $request)
|
||||
{
|
||||
//$path = Config::get('cms.storage.media.path');
|
||||
|
||||
|
||||
$dataAccounts = User::where('is_featured', 1)
|
||||
->select('id', 'name', 'email', 'username', 'type', 'logo', 'shop_title', 'slogan', 'work_time', 'description', 'map')
|
||||
->get();
|
||||
|
||||
//$dataSlider["img"] = $path.$dataSlider["img"];
|
||||
|
||||
if($dataAccounts){
|
||||
$dataAccounts->each(function ($item, $key) {
|
||||
$item->logo = 'http://78.111.88.8:9086'.Config::get('cms.storage.media.path').$item->logo;
|
||||
});
|
||||
}
|
||||
|
||||
return response()->json($dataAccounts, 200);
|
||||
}
|
||||
|
||||
|
||||
public function getSliders(Request $request)
|
||||
{
|
||||
$path = Config::get('cms.storage.media.path');
|
||||
|
|
|
|||
|
|
@ -47,8 +47,8 @@ class ProductsAPIController extends Controller
|
|||
$query = $this->Product::with([
|
||||
'translations:locale,model_id,attribute_data',
|
||||
'images:attachment_id,attachment_type,disk_name,file_name',
|
||||
'measure.translations:locale,model_id,attribute_data',
|
||||
'currency.translations:locale,model_id,attribute_data'
|
||||
//'measure.translations:locale,model_id,attribute_data',
|
||||
//'currency.translations:locale,model_id,attribute_data'
|
||||
])
|
||||
// ->approvedAndFreshEndDate()
|
||||
->approved()
|
||||
|
|
@ -62,8 +62,8 @@ class ProductsAPIController extends Controller
|
|||
->with([
|
||||
'translations:locale,model_id,attribute_data',
|
||||
'images:attachment_id,attachment_type,disk_name,file_name',
|
||||
'measure.translations:locale,model_id,attribute_data',
|
||||
'currency.translations:locale,model_id,attribute_data'
|
||||
//'measure.translations:locale,model_id,attribute_data',
|
||||
//'currency.translations:locale,model_id,attribute_data'
|
||||
])
|
||||
// ->approvedAndFreshEndDate()
|
||||
->approved()
|
||||
|
|
@ -86,8 +86,8 @@ class ProductsAPIController extends Controller
|
|||
->with([
|
||||
'translations:locale,model_id,attribute_data',
|
||||
'images:attachment_id,attachment_type,disk_name,file_name',
|
||||
'measure.translations:locale,model_id,attribute_data',
|
||||
'currency.translations:locale,model_id,attribute_data'
|
||||
//'measure.translations:locale,model_id,attribute_data',
|
||||
//'currency.translations:locale,model_id,attribute_data'
|
||||
])
|
||||
// ->approvedAndFreshEndDate()
|
||||
->approved()
|
||||
|
|
@ -102,18 +102,18 @@ class ProductsAPIController extends Controller
|
|||
->with([
|
||||
'translations:locale,model_id,attribute_data',
|
||||
'images:attachment_id,attachment_type,disk_name,file_name',
|
||||
'measure.translations:locale,model_id,attribute_data',
|
||||
'currency.translations:locale,model_id,attribute_data'
|
||||
//'measure.translations:locale,model_id,attribute_data',
|
||||
//'currency.translations:locale,model_id,attribute_data'
|
||||
])
|
||||
->orderBy('ends_at', $sortOrder);
|
||||
}
|
||||
|
||||
$data = $query ? $query->paginate($perPage) : null;
|
||||
if($data) {
|
||||
foreach ($data as $product) {
|
||||
$product->unit = new MeasureResource($product->measure);
|
||||
}
|
||||
}
|
||||
//if($data) {
|
||||
// foreach ($data as $product) {
|
||||
// $product->unit = new MeasureResource($product->measure);
|
||||
// }
|
||||
// }
|
||||
|
||||
// if($data) {
|
||||
// $data->each(function ($item, $key) {
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ Route::group(['prefix' =>'api/v1','namespace' =>'AhmadFatoni\ApiGenerator\Contro
|
|||
Route::get('news/{id}', 'BlogPostsApiController@show')->where(['id' => '[0-9]+']);
|
||||
|
||||
Route::get('sliders', 'BlogPostsApiController@getSliders');
|
||||
Route::get('accounts', 'BlogPostsApiController@getAccounts');
|
||||
|
||||
Route::middleware(['\Tymon\JWTAuth\Middleware\GetUserFromToken'])->group(function () {
|
||||
|
||||
|
|
|
|||
|
|
@ -126,6 +126,12 @@ tabs:
|
|||
span: auto
|
||||
type: textarea
|
||||
tab: Gurlushyk
|
||||
is_featured:
|
||||
label: 'Bash Sahypa'
|
||||
span: auto
|
||||
disabled: 0
|
||||
type: switch
|
||||
tab: Gurlushyk
|
||||
categories:
|
||||
label: Relation
|
||||
nameFrom: name
|
||||
|
|
|
|||
|
|
@ -35,9 +35,9 @@ class Product extends Model
|
|||
'slug' => 'required',
|
||||
'images' => 'required',
|
||||
'quantity' => 'required',
|
||||
'measure' => 'required',
|
||||
//'measure' => 'required',
|
||||
'price' => 'required|numeric|max:9999999',
|
||||
'currency' => 'required',
|
||||
//'currency' => 'required',
|
||||
];
|
||||
|
||||
public $customMessages = [
|
||||
|
|
@ -50,10 +50,10 @@ class Product extends Model
|
|||
|
||||
public $belongsTo = [
|
||||
// 'country' => ['TPS\Birzha\Models\Country'],
|
||||
'measure' => ['TPS\Birzha\Models\Measure','key' => 'measure_id'],
|
||||
'currency' => ['TPS\Birzha\Models\Currency'],
|
||||
'payment_term' => ['TPS\Birzha\Models\Term','key' => 'payment_term_id'],
|
||||
'delivery_term' => ['TPS\Birzha\Models\Term','key' => 'delivery_term_id'],
|
||||
//'measure' => ['TPS\Birzha\Models\Measure','key' => 'measure_id'],
|
||||
//'currency' => ['TPS\Birzha\Models\Currency'],
|
||||
//'payment_term' => ['TPS\Birzha\Models\Term','key' => 'payment_term_id'],
|
||||
//'delivery_term' => ['TPS\Birzha\Models\Term','key' => 'delivery_term_id'],
|
||||
'vendor' => User::class,
|
||||
'payment' => ['TPS\Birzha\Models\Payment'],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -7,13 +7,11 @@ columns:
|
|||
label: Name
|
||||
type: text
|
||||
searchable: true
|
||||
sortable:
|
||||
user_id:
|
||||
label: User
|
||||
type: vendor
|
||||
relation: vendor
|
||||
sortable: false
|
||||
valueFrom: email
|
||||
valueFrom: username
|
||||
status:
|
||||
label: Status
|
||||
type: status
|
||||
|
|
|
|||
|
|
@ -22,14 +22,6 @@ fields:
|
|||
span: auto
|
||||
readOnly: 1
|
||||
type: datepicker
|
||||
manufacturer:
|
||||
label: Manufacturer
|
||||
span: auto
|
||||
type: text
|
||||
country:
|
||||
label: 'Manufacturer country'
|
||||
span: auto
|
||||
type: text
|
||||
quantity:
|
||||
label: Quantity
|
||||
span: auto
|
||||
|
|
@ -39,12 +31,6 @@ fields:
|
|||
mode: datetime
|
||||
span: auto
|
||||
type: datepicker
|
||||
measure:
|
||||
label: Measure
|
||||
nameFrom: name
|
||||
descriptionFrom: description
|
||||
span: auto
|
||||
type: relation
|
||||
price:
|
||||
label: Price
|
||||
span: auto
|
||||
|
|
@ -55,26 +41,6 @@ fields:
|
|||
mode: tab
|
||||
span: auto
|
||||
type: text
|
||||
currency:
|
||||
label: Currency
|
||||
nameFrom: name
|
||||
descriptionFrom: description
|
||||
span: auto
|
||||
type: relation
|
||||
payment_term:
|
||||
label: 'Payment term'
|
||||
nameFrom: name
|
||||
descriptionFrom: description
|
||||
scope: payment
|
||||
span: auto
|
||||
type: relation
|
||||
delivery_term:
|
||||
label: 'Delivery term'
|
||||
nameFrom: name
|
||||
descriptionFrom: description
|
||||
scope: delivery
|
||||
span: auto
|
||||
type: relation
|
||||
place:
|
||||
label: Place
|
||||
span: auto
|
||||
|
|
@ -85,11 +51,6 @@ fields:
|
|||
descriptionFrom: description
|
||||
span: auto
|
||||
type: relation
|
||||
payed_fee_for_publ:
|
||||
label: 'Payed for publication'
|
||||
span: auto
|
||||
disabled: 1
|
||||
type: number
|
||||
images:
|
||||
label: Images
|
||||
mode: image
|
||||
|
|
@ -101,20 +62,6 @@ fields:
|
|||
extension: auto
|
||||
span: auto
|
||||
type: fileupload
|
||||
packaging:
|
||||
label: Packaging
|
||||
options:
|
||||
'no': 'no'
|
||||
'yes': 'yes'
|
||||
span: auto
|
||||
type: balloon-selector
|
||||
market_type:
|
||||
label: 'Market type'
|
||||
options:
|
||||
in: in
|
||||
out: out
|
||||
span: left
|
||||
type: balloon-selector
|
||||
tabs:
|
||||
fields:
|
||||
categories:
|
||||
|
|
@ -129,11 +76,11 @@ tabs:
|
|||
status:
|
||||
label: Status
|
||||
options:
|
||||
draft: Draft
|
||||
new: New
|
||||
approved: Approved
|
||||
denied: Denied
|
||||
disabled: Disabled
|
||||
draft: Pozulan
|
||||
new: Taze
|
||||
approved: Tassyklandy
|
||||
denied: 'Otkaz Edildi'
|
||||
disabled: 'Wagtlayyn Ochurmek'
|
||||
span: auto
|
||||
required: 1
|
||||
type: balloon-selector
|
||||
|
|
|
|||
Loading…
Reference in New Issue