Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
liexin_supplier
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
90ac87a5
authored
Jul 17, 2025
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
sku批次和sku展示类型打标签/来源打标签
parent
81a5362d
Show whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
499 additions
and
2500 deletions
.env
app/Http/Controllers/Api/SkuApiController.php
app/Http/Controllers/Api/SupplierApiController.php
app/Http/Controllers/SkuController.php
app/Http/Controllers/SupplierController.php
app/Http/Services/SupplierTagService.php
app/Http/Transformers/SupplierTransformer.php
app/Http/Validators/SupplierValidator.php
app/Presenters/MultiSelectorPresenter.php
config/field.php
config/validate.php
resources/views/script/BatchAddSkuTagScript.blade.php
resources/views/web/BatchAddSkuTag.blade.php
resources/views/web/SupplierDetail.blade.php
resources/views/web/supplier/SkuRuler.blade.php
vendor/_laravel_ide/discover-1e7ea3cf42a2f9b84f3de09530e2c135.php
vendor/_laravel_ide/discover-31b934f114eabc246b541addb8b458e3.php
vendor/_laravel_ide/discover-320fe5c5b7f0175eae37c44f264ceb08.php
vendor/_laravel_ide/discover-476fe65492650d7ce55de1f8f96024c5.php
vendor/_laravel_ide/discover-5802e590a92e23606bb54d2909564178.php
vendor/_laravel_ide/discover-67043687ec5f16a5c4357b3dc049d2d5.php
vendor/_laravel_ide/discover-7563160ca998bde672640aa1e68dfd08.php
vendor/_laravel_ide/discover-77e9e6a2445455b87d4f4cd834e4e23d.php
vendor/_laravel_ide/discover-79de9752f999b6e261cd05abba67a5ce.php
vendor/_laravel_ide/discover-9abd86d674d0ba851f4ac7b31349196a.php
vendor/_laravel_ide/discover-d769f81c5eaf96f1f253a56481405376.php
vendor/_laravel_ide/discover-e691d398bdcb7c046a57f3e4553bb28a.php
vendor/_laravel_ide/discover-ea280fb1636eb761c4fd23f76666e397.php
.env
View file @
90ac87a5
...
...
@@ -160,7 +160,7 @@ MENU_ID=16
MENU_URL=http://data.liexin.net/api/config/
FOOTSTONE_URL=http://footstone.liexindev.net
#标签系统的地址
TAG_URL=http://tag.liexinlocal.com
TAG_URL=http://tag.liexinlocal.com
:32581
SKIP_SEND_EMAIL=true
...
...
app/Http/Controllers/Api/SkuApiController.php
View file @
90ac87a5
...
...
@@ -2,12 +2,13 @@
namespace
App\Http\Controllers\Api
;
use
App\Http\Controllers\Controller
;
use
App\Http\Services\SkuService
;
use
Illuminate\Http\Request
;
use
App\Model\SkuUploadLogModel
;
use
App\Http\Services\SkuService
;
use
App\Model\SupplierChannelModel
;
use
Illuminate\Http\Request
;
use
App\Http\Controllers\Controller
;
use
function
GuzzleHttp
\Promise\all
;
use
App\Http\Services\SupplierTagService
;
//通用API,比如获取品牌列表,分类列表等
class
SkuApiController
extends
Controller
...
...
@@ -173,6 +174,9 @@ class SkuApiController extends Controller
//批量新增标签
public
function
BatchAddSkuTag
(
$request
)
{
$currentTab
=
$request
->
input
(
'current_tab'
);
switch
(
$currentTab
)
{
case
'tag_setting'
:
$type
=
$request
->
input
(
'type'
);
$supplierCode
=
$request
->
input
(
'supplier_code'
);
$skuIds
=
$request
->
get
(
'sku_ids'
);
...
...
@@ -184,8 +188,25 @@ class SkuApiController extends Controller
$this
->
response
(
-
1
,
'按供应商设置标签,必须先选择供应商'
);
}
(
new
SkuService
())
->
batchAddSkuTags
(
$type
,
$supplierCode
,
$skuIds
,
$skuTags
);
$text
=
$type
==
1
?
'设置标签成功'
:
'批量设置供应商SKU标签任务已开始,请等待任务完成'
;
break
;
case
'goods_label'
:
$goodsLabel
=
$request
->
get
(
'goods_label'
);
$goodsLabelSystemTags
=
$request
->
get
(
'goods_label_system_tags'
);
(
new
SupplierTagService
())
->
batchSaveGoodsLabelTags
(
$goodsLabel
,
$goodsLabelSystemTags
);
$text
=
'设置显示类型标签成功'
;
break
;
case
'goods_source'
:
$goodsSource
=
$request
->
get
(
'goods_source'
);
$goodsSourceSystemTags
=
$request
->
get
(
'goods_source_system_tags'
);
(
new
SupplierTagService
())
->
batchSaveGoodsSourceTags
(
$goodsSource
,
$goodsSourceSystemTags
);
$text
=
'设置接入方式标签成功'
;
break
;
default
:
$this
->
response
(
-
1
,
'请选择操作类型'
);
}
$this
->
response
(
0
,
$text
);
}
...
...
app/Http/Controllers/Api/SupplierApiController.php
View file @
90ac87a5
...
...
@@ -101,6 +101,8 @@ class SupplierApiController extends Controller
'agency_brands'
,
'purchase_type'
,
'sign_com_id'
,
'sku_optional_batch'
,
];
public
function
Entrance
(
Request
$request
,
$id
)
...
...
app/Http/Controllers/SkuController.php
View file @
90ac87a5
...
...
@@ -11,6 +11,7 @@ use Illuminate\Http\Request;
use
App\Model\IntracodeModel
;
use
App\Model\SupplierLogModel
;
use
App\Http\Services\LogService
;
use
App\Http\Services\SkuService
;
use
App\Model\SupplierChannelModel
;
use
App\Http\Services\SupplierService
;
use
App\Http\Services\DepartmentService
;
...
...
@@ -110,7 +111,7 @@ class SkuController extends Controller
//批量打标签
public
function
BatchAddSkuTag
(
$request
)
{
$systemTags
=
(
new
SkuService
())
->
getSystemTags
();
$this
->
data
[
'title'
]
=
'批量修改Sku标签'
;
$suppliers
=
SupplierChannelModel
::
where
(
'is_type'
,
0
)
->
where
(
'status'
,
2
)
->
select
([
'supplier_name'
,
'supplier_code'
])
->
get
();
...
...
@@ -124,8 +125,25 @@ class SkuController extends Controller
$skuIds
=
explode
(
','
,
$skuIds
);
$this
->
data
[
'skuIds'
]
=
$skuIds
;
}
$supplierCodesForXmSelect
=
$supplierCodes
;
foreach
(
$supplierCodesForXmSelect
as
$key
=>
$value
)
{
$supplierCodesForXmSelect
[
$key
]
=
[
'name'
=>
$value
,
'value'
=>
$key
];
}
$supplierCodesForXmSelect
=
array_values
(
$supplierCodesForXmSelect
);
$this
->
data
[
'supplierCodesForXmSelect'
]
=
$supplierCodesForXmSelect
;
$systemTagsForXmSelect
=
$systemTags
;
foreach
(
$systemTagsForXmSelect
as
$key
=>
$value
)
{
$systemTagsForXmSelect
[
$key
]
=
[
'name'
=>
$value
[
'tag_name'
],
'value'
=>
$value
[
'tag_id'
]];
}
$systemTagsForXmSelect
=
array_values
(
$systemTagsForXmSelect
);
$this
->
data
[
'systemTagsForXmSelect'
]
=
$systemTagsForXmSelect
;
//获取已经设置的标签
$goodsLabelSystemTagList
=
(
new
SupplierTagService
())
->
getGoodsLabelSystemTagList
();
$this
->
data
[
'goodsLabelSystemTagList'
]
=
$goodsLabelSystemTagList
;
$goodsSourceSystemTagList
=
(
new
SupplierTagService
())
->
getGoodsSourceSystemTagList
();
$this
->
data
[
'goodsSourceSystemTagList'
]
=
$goodsSourceSystemTagList
;
$this
->
data
[
'supplierCodes'
]
=
$supplierCodes
;
return
$this
->
view
(
'批量修改Sku标签'
);
}
...
...
app/Http/Controllers/SupplierController.php
View file @
90ac87a5
...
...
@@ -149,6 +149,15 @@ class SupplierController extends Controller
$this
->
data
[
'sku_upload_log_count'
]
=
(
new
SkuUploadLogService
())
->
getSkuUploadLogCount
(
$supplierId
);
$ruleService
=
new
RuleService
();
$this
->
data
[
'rule'
]
=
$ruleService
->
getSupplierRule
(
$supplier
[
'supplier_code'
]);
$skuOptionalBatch
=
config
(
'field.SkuOptionalBatch'
);
foreach
(
$skuOptionalBatch
as
$key
=>
$value
)
{
$skuOptionalBatchXmSelect
[]
=
[
'name'
=>
$value
,
'value'
=>
$key
,
];
}
$this
->
data
[
'sku_optional_batch_for_xm_select'
]
=
$skuOptionalBatchXmSelect
;
return
$this
->
view
(
'供应商详情'
);
}
...
...
@@ -254,6 +263,14 @@ class SupplierController extends Controller
$ruleService
=
new
RuleService
();
$this
->
data
[
'rule'
]
=
$ruleService
->
getSupplierRule
(
$supplier
[
'supplier_code'
]);
$skuOptionalBatchForXmSelect
=
[];
foreach
(
config
(
'field.SkuOptionalBatch'
)
as
$key
=>
$value
)
{
$skuOptionalBatchForXmSelect
[]
=
[
'value'
=>
$key
,
'name'
=>
$value
,
];
}
$this
->
data
[
'sku_optional_batch_for_xm_select'
]
=
$skuOptionalBatchForXmSelect
;
return
$this
->
view
(
'编辑供应商'
);
}
...
...
app/Http/Services/SupplierTagService.php
View file @
90ac87a5
...
...
@@ -4,10 +4,11 @@
namespace
App\Http\Services
;
//后台用户相关信息服务
use
App\Model\SupplierChannelModel
;
use
GuzzleHttp\Client
;
use
App\Model\RedisModel
;
use
GuzzleHttp\RequestOptions
;
use
Illuminate\Support\Facades\DB
;
use
App\Model\SupplierChannelModel
;
use
Illuminate\Support\Facades\Log
;
class
SupplierTagService
...
...
@@ -162,4 +163,50 @@ class SupplierTagService
]);
}
}
//获取供应商的系统标签
public
function
getGoodsLabelSystemTagList
()
{
$redis
=
new
RedisModel
();
$data
=
$redis
->
hgetall
(
'goods_label_tags'
);
$data
=
array_map
(
function
(
$item
)
{
return
json_decode
(
$item
,
true
);
},
$data
);
return
$data
;
}
//获取供应商的接入方式标签
public
function
getGoodsSourceSystemTagList
()
{
$redis
=
new
RedisModel
();
$data
=
$redis
->
hgetall
(
'goods_source_tags'
);
$data
=
array_map
(
function
(
$item
)
{
return
json_decode
(
$item
,
true
);
},
$data
);
return
$data
;
}
//批量更新供应商的SKU显示类型
public
function
batchSaveGoodsLabelTags
(
$goodsLabel
,
$goodsLabelSystemTags
)
{
$goodsLabelSystemTags
=
explode
(
','
,
$goodsLabelSystemTags
);
$data
=
[
'system_tags'
=>
$goodsLabelSystemTags
,
];
//存到redis中
$redis
=
new
RedisModel
();
$redis
->
hset
(
'goods_label_tags'
,
$goodsLabel
,
json_encode
(
$data
));
}
//批量更新供应商的SKU接入方式
public
function
batchSaveGoodsSourceTags
(
$goodsSource
,
$goodsSourceSystemTags
)
{
$goodsSourceSystemTags
=
explode
(
','
,
$goodsSourceSystemTags
);
$data
=
[
'system_tags'
=>
$goodsSourceSystemTags
,
];
//存到redis中
$redis
=
new
RedisModel
();
$redis
->
hset
(
'goods_source_tags'
,
$goodsSource
,
json_encode
(
$data
));
}
}
app/Http/Transformers/SupplierTransformer.php
View file @
90ac87a5
...
...
@@ -262,6 +262,7 @@ class SupplierTransformer
$supplier
[
'purchase_type_name'
]
=
array_get
(
config
(
'field.PurchaseType'
),
$supplier
[
'purchase_type'
],
'无'
);
$supplier
[
'cp_time_format'
]
=
(
'现货 : '
.
(
$supplier
[
'cp_time_day'
]
==
-
1
?
'无限制'
:
$supplier
[
'cp_time_day'
]
.
'天'
))
.
' | '
.
(
'期货 : '
.
(
$supplier
[
'futures_cp_time_day'
]
==
-
1
?
'无限制'
:
$supplier
[
'futures_cp_time_day'
]
.
'天'
));
$supplier
[
'sku_optional_batch_text'
]
=
$this
->
getSkuOptionalBatchText
(
$supplier
[
'sku_optional_batch'
]);
return
$supplier
;
}
...
...
@@ -421,4 +422,14 @@ class SupplierTransformer
return
$supplier
;
}
public
function
getSkuOptionalBatchText
(
$skuOptionalBatch
)
{
$skuOptionalBatch
=
explode
(
','
,
$skuOptionalBatch
);
$skuOptionalBatchText
=
[];
foreach
(
$skuOptionalBatch
as
$batch
)
{
$skuOptionalBatchText
[]
=
array_get
(
config
(
'field.SkuOptionalBatch'
),
$batch
);
}
return
implode
(
','
,
$skuOptionalBatchText
);
}
}
app/Http/Validators/SupplierValidator.php
View file @
90ac87a5
...
...
@@ -335,6 +335,11 @@ class SupplierValidator
if
(
$notCompleteContacts
)
{
$errorMessageList
[]
=
"存在和你相关的联系人没有完善,请先去完善相关联系人"
;
}
//还要校验sku可选批次
if
(
!
$validateData
[
'sku_optional_batch'
])
{
$errorMessageList
[]
=
"请设置SKU可选批次,在SKU概况栏"
;
}
}
return
implode
(
'|'
,
$errorMessageList
);
...
...
app/Presenters/MultiSelectorPresenter.php
View file @
90ac87a5
...
...
@@ -13,6 +13,8 @@ class MultiSelectorPresenter
$width
=
array_get
(
$option
,
'width'
,
'157px'
);
$radio
=
array_get
(
$option
,
'radio'
,
'false'
);
$requiredHtml
=
$isRequired
?
'<span style="color: red">*</span>'
:
""
;
$disable
=
array_get
(
$option
,
'disable'
,
false
);
$disable
=
$disable
?
"true"
:
"false"
;
$elemId
=
$name
.
"Selector"
;
$data
=
json_encode
(
$data
);
$html
=
<<<EOF
...
...
@@ -39,6 +41,7 @@ class MultiSelectorPresenter
value: 'value'
},
radio: $radio,
disabled: $disable,
size: 'mini',
direction: 'down',
data : $data,
...
...
config/field.php
View file @
90ac87a5
...
...
@@ -362,4 +362,14 @@ return [
2
=>
'京东采购'
,
3
=>
'华云采购'
,
],
'SkuOptionalBatch'
=>
[
-
1
=>
'无法指定'
,
1
=>
'任意批次'
,
2
=>
'1年内'
,
3
=>
'2年内'
,
4
=>
'3年内'
,
5
=>
'4年内'
,
6
=>
'5年内'
,
],
];
config/validate.php
View file @
90ac87a5
...
...
@@ -59,5 +59,6 @@ return [
'purchase_type_name'
=>
'代购类型'
,
'sign_com_id'
=>
'签约公司id'
,
'sign_com_name'
=>
'签约公司名称'
,
'sku_optional_batch_text'
=>
'SKU可选批次'
,
]
];
resources/views/script/BatchAddSkuTagScript.blade.php
View file @
90ac87a5
<script>
layui
.
use
([
'table'
,
'form'
,
'element'
,
'table'
,
'xmSelect'
,
'tagsInput'
,
'layer'
,
'admin'
],
function
()
{
layui
.
use
([
'table'
,
'form'
,
'element'
,
'table'
,
'xmSelect'
,
'tagsInput'
,
'layer'
,
'admin'
],
function
()
{
let
admin
=
layui
.
admin
;
let
form
=
layui
.
form
;
let
table
=
layui
.
table
let
table
=
layui
.
table
;
let
element
=
layui
.
element
;
let
xmSelect
=
layui
.
xmSelect
;
let
tagsInput
=
layui
.
tagsInput
;
form
.
on
(
'submit(addSkuTag)'
,
function
(
data
)
{
// 获取当前激活的tab索引
function
getCurrentTabIndex
()
{
let
activeTab
=
$
(
'.layui-tab-title .layui-this'
);
return
activeTab
.
index
();
}
// 获取当前激活的tab名称
function
getCurrentTabName
()
{
let
tabIndex
=
getCurrentTabIndex
();
switch
(
tabIndex
)
{
case
0
:
return
'tag_setting'
;
case
1
:
return
'goods_label'
;
case
2
:
return
'goods_source'
;
default
:
return
'tag_setting'
;
}
}
// 标签设置tab的校验规则
function
validateTagSettingTab
(
data
)
{
// 检查SKU是否已选择
let
skuIds
=
data
.
field
.
sku_ids
;
if
(
!
skuIds
||
skuIds
.
trim
()
===
''
)
{
layer
.
msg
(
'请先选择SKU'
,
{
icon
:
5
});
return
false
;
}
// 检查设置方式
if
(
!
data
.
field
.
type
)
{
layer
.
msg
(
'请选择设置方式'
,
{
icon
:
5
});
return
false
;
}
// 如果选择按型号,检查型号不能为空
if
(
data
.
field
.
type
===
'1'
)
{
// 这里需要根据实际的型号字段名进行校验
// 假设型号字段名为 model_number 或者从SKU中提取
if
(
!
data
.
field
.
sku_ids
||
data
.
field
.
sku_ids
.
trim
()
===
''
)
{
layer
.
msg
(
'请选择型号'
,
{
icon
:
5
});
return
false
;
}
}
// 如果选择按供应商,检查是否选择了供应商
if
(
data
.
field
.
type
===
'2'
)
{
if
(
!
data
.
field
.
supplier_code
||
data
.
field
.
supplier_code
===
''
)
{
layer
.
msg
(
'请选择供应商'
,
{
icon
:
5
});
return
false
;
}
}
return
true
;
}
// 按SKU显示类型tab的校验规则
function
validateGoodsLabelTab
(
data
)
{
// 检查是否选择了显示类型
if
(
!
data
.
field
.
goods_label
||
data
.
field
.
goods_label
===
''
)
{
layer
.
msg
(
'请选择SKU显示类型'
,
{
icon
:
5
});
return
false
;
}
// 检查是否选择了系统标签
if
(
!
data
.
field
.
goods_label_system_tags
||
data
.
field
.
goods_label_system_tags
===
''
)
{
layer
.
msg
(
'请选择系统标签'
,
{
icon
:
5
});
return
false
;
}
return
true
;
}
// 按SKU接入方式tab的校验规则
function
validateGoodsSourceTab
(
data
)
{
// 检查是否选择了接入方式
if
(
!
data
.
field
.
goods_source
||
data
.
field
.
goods_source
===
''
)
{
layer
.
msg
(
'请选择SKU接入方式'
,
{
icon
:
5
});
return
false
;
}
// 检查是否选择了系统标签
if
(
!
data
.
field
.
goods_source_system_tags
||
data
.
field
.
goods_source_system_tags
===
''
)
{
layer
.
msg
(
'请选择系统标签'
,
{
icon
:
5
});
return
false
;
}
return
true
;
}
form
.
on
(
'submit(addSkuTag)'
,
function
(
data
)
{
let
currentTab
=
getCurrentTabName
();
// 将当前tab信息添加到提交数据中
data
.
field
.
current_tab
=
currentTab
;
// 根据当前tab进行不同的校验
switch
(
currentTab
)
{
case
'tag_setting'
:
if
(
!
validateTagSettingTab
(
data
))
{
return
false
;
}
// 标签设置tab的提交逻辑
if
(
data
.
field
.
sku_tags
===
''
)
{
layer
.
confirm
(
'如果没有选择任何标签点击确认将把原标签全部删除,确定要删除吗?'
,
function
(
index
)
{
addSkuTag
(
data
);
layer
.
confirm
(
'如果没有选择任何标签点击确认将把原标签全部删除,确定要删除吗?'
,
function
(
index
)
{
addSkuTag
(
data
,
currentTab
);
layer
.
close
(
index
);
});
}
else
{
addSkuTag
(
data
);
addSkuTag
(
data
,
currentTab
);
}
break
;
case
'goods_label'
:
if
(
!
validateGoodsLabelTab
(
data
))
{
return
false
;
}
// 按SKU显示类型的提交逻辑
if
(
data
.
field
.
goods_label_system_tags
===
''
)
{
layer
.
confirm
(
'如果没有选择任何标签点击确认将把原标签全部删除,确定要删除吗?'
,
function
(
index
)
{
addSkuTag
(
data
,
currentTab
);
layer
.
close
(
index
);
});
}
else
{
addSkuTag
(
data
,
currentTab
);
}
break
;
function
addSkuTag
(
data
)
{
case
'goods_source'
:
if
(
!
validateGoodsSourceTab
(
data
))
{
return
false
;
}
// 按SKU接入方式的提交逻辑
if
(
data
.
field
.
goods_source_system_tags
===
''
)
{
layer
.
confirm
(
'如果没有选择任何标签点击确认将把原标签全部删除,确定要删除吗?'
,
function
(
index
)
{
addSkuTag
(
data
,
currentTab
);
layer
.
close
(
index
);
});
}
else
{
addSkuTag
(
data
,
currentTab
);
}
break
;
default
:
layer
.
msg
(
'未知的tab类型'
,
{
icon
:
5
});
return
false
;
}
});
function
addSkuTag
(
data
,
currentTab
)
{
admin
.
showLoading
({
type
:
3
});
let
sku_ids
=
getQueryVariable
(
'sku_ids'
);
let
url
=
'/api/sku/BatchAddSkuTag'
;
// 确保当前tab信息被包含在提交数据中
let
submitData
=
data
.
field
;
if
(
currentTab
)
{
submitData
.
current_tab
=
currentTab
;
}
console
.
log
(
'提交数据:'
,
submitData
);
// 调试用,可以看到传递的tab信息
$
.
ajax
({
url
:
url
,
type
:
'POST'
,
async
:
true
,
data
:
data
.
field
,
dataType
:
'json'
,
timeout
:
20000
,
success
:
function
(
res
)
{
url
:
url
,
type
:
'POST'
,
async
:
true
,
data
:
submitData
,
dataType
:
'json'
,
timeout
:
20000
,
success
:
function
(
res
)
{
admin
.
removeLoading
();
if
(
res
.
err_code
===
0
)
{
layer
.
msg
(
res
.
err_msg
,
{
icon
:
6
});
setTimeout
(
function
()
{
layer
.
msg
(
res
.
err_msg
,
{
icon
:
6
});
setTimeout
(
function
()
{
admin
.
closeThisDialog
();
},
1000
);
}
else
{
layer
.
msg
(
res
.
err_msg
,
{
icon
:
5
});
layer
.
msg
(
res
.
err_msg
,
{
icon
:
5
});
}
}
},
error
:
function
()
{
,
error
:
function
()
{
admin
.
removeLoading
();
layer
.
msg
(
'网络错误'
,
{
icon
:
5
});
layer
.
msg
(
'网络错误'
,
{
icon
:
5
});
}
});
}
form
.
on
(
'submit(cancel)'
,
function
(
data
)
{
form
.
on
(
'submit(cancel)'
,
function
(
data
)
{
admin
.
closeThisDialog
();
});
form
.
on
(
'radio(type)'
,
function
(
data
)
{
form
.
on
(
'radio(type)'
,
function
(
data
)
{
if
(
data
.
value
===
'1'
)
{
$
(
'#supplier_select_div'
).
hide
();
$
(
'#selected_sku_id'
).
show
();
...
...
@@ -70,20 +243,20 @@
let
tagResult
=
ajax
(
url
);
let
tagList
=
tagResult
.
data
;
return
{
el
:
'#'
+
element
,
filterable
:
true
,
paging
:
true
,
height
:
'250px'
,
size
:
'small'
,
direction
:
'auto'
,
autoRow
:
true
,
prop
:
{
name
:
'tag_name'
,
value
:
'tag_id'
,
},
pageSize
:
30
,
data
:
tagList
,
on
:
function
(
tagList
)
{
el
:
'#'
+
element
,
filterable
:
true
,
paging
:
true
,
height
:
'250px'
,
size
:
'small'
,
direction
:
'auto'
,
autoRow
:
true
,
prop
:
{
name
:
'tag_name'
,
value
:
'tag_id'
,
}
,
pageSize
:
30
,
data
:
tagList
,
on
:
function
(
tagList
)
{
let
arr
=
tagList
.
arr
;
let
tagIds
=
''
;
for
(
let
i
in
arr
)
{
...
...
@@ -91,11 +264,12 @@
}
let
idName
=
'sku_tags'
;
$
(
'#'
+
idName
).
val
(
tagIds
);
}
,
};
}
,
};
}
let
systemTagOption
=
getTagOption
(
'sku_tags_selector'
,
2
);
let
tagSelector
=
xmSelect
.
render
(
systemTagOption
);
});
</script>
resources/views/web/BatchAddSkuTag.blade.php
View file @
90ac87a5
...
...
@@ -2,82 +2,173 @@
.layui-form-item
{
margin-bottom
:
5px
;
}
.layui-tab-content
{
padding
:
20px
;
}
</style>
<form
class=
"layui-form"
action=
""
>
<div
class=
"layui-card"
>
<div
class=
"layui-card-header"
style=
"height: 100%"
>
<div
class=
"layui-card-body"
>
<div
class=
"layui-tab layui-tab-brief"
lay-filter=
"batchSkuTab"
>
<ul
class=
"layui-tab-title"
>
<li
class=
"layui-this"
>
标签设置
</li>
<li>
按SKU显示类型
</li>
<li>
按SKU接入方式
</li>
</ul>
<div
class=
"layui-tab-content"
>
<!-- 标签设置选项卡 -->
<div
class=
"layui-tab-item layui-show"
>
<input
type=
"hidden"
name=
"sku_ids"
id=
"sku_ids"
value=
"{{request()->get('sku_ids')}}"
>
@if(request()->get('sku_ids'))
<div
id=
"selected_sku_id"
>
<blockquote
class=
"layui-elem-quote layui-text"
>
<b>
选择的sku
</b>
<b>
已选择的SKU列表
</b>
</blockquote>
<div
class=
"layui-form-item"
>
<table
class=
"layui-table"
>
<tbody>
@foreach($skuIds as $skuId)
<thead>
<tr>
<td>
{{$skuId}}
</td
>
<th>
SKU ID
</th
>
</tr>
@endforeach
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
@else
<div
class=
"layui-empty"
>
<p
class=
"layui-empty-text"
>
暂无选择的SKU
</p>
<br
/>
</div>
@endif
<blockquote
class=
"layui-elem-quote layui-text"
>
<b>
设置标签
</b>
</blockquote>
<input
type=
"hidden"
name=
"sku_ids"
id=
"sku_ids"
value=
"{{request()->get('sku_ids')}}"
>
<div
class=
"layui-form-item"
>
<div
class=
"layui-input-block"
style=
"margin-left: -30px"
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
设置方式 :
</label>
<div
class=
"layui-input-block"
style=
"margin-top: 10px"
>
<label
class=
"layui-form-label"
>
设置方式
</label>
<div
class=
"layui-input-block"
>
<input
type=
"radio"
lay-filter=
"type"
name=
"type"
value=
"1"
title=
"按型号"
checked
>
<input
type=
"radio"
lay-filter=
"type"
name=
"type"
value=
"2"
title=
"按供应商"
>
</div>
</div>
<div
class=
"layui-form-item"
id=
"supplier_select_div"
style=
"display: none"
>
@inject('multiSelectorPresenter','App\Presenters\MultiSelectorPresenter')
{!! $multiSelectorPresenter->render('supplier_code','供应商选择',null,
$supplierCodesForXmSelect,['radio'=>true,'required'=>true,'width'=>'400px']) !!}
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
>
系统标签
</label>
<div
class=
"layui-input-block"
>
<div
id=
"sku_tags_selector"
class=
"layui-input-inline"
style=
"width: 100%;"
>
</div>
<input
type=
"hidden"
name=
"sku_tags"
id=
"sku_tags"
>
<div
class=
"layui-form-mid layui-word-aux"
style=
"color: red; margin-top: 10px;"
>
选择标签会覆盖原有标签。如果没有选择任何标签点击确认将把原标签全部删除
</div>
</div>
</div>
<div
class=
"layui-form-item"
id=
"supplier_select_div"
style=
"display: none"
>
<div
class=
"layui-inline"
style=
"margin-left: -30px"
>
</div>
<!-- 按SKU显示类型选项卡 -->
<div
class=
"layui-tab-item"
>
<blockquote
class=
"layui-elem-quote layui-text"
>
<b>
设置显示类型
</b>
</blockquote>
<div
class=
"layui-form-item"
>
<div
class=
"layui-inline"
>
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('supplier_code','供应商选择 : ',null,
$supplierCodes,['required'=>true,'width'=>'400px']) !!}
{!! $statusPresenter->render('goods_label','SKU显示类型 : ',null,
config('field.SkuGoodsLabel'),['required'=>true,'label_width'=>'100px']) !!}
</div>
</div>
<div
class=
"layui-form-item"
style=
"margin-left: 20px;"
>
<div
class=
"layui-inline"
>
@inject('multiSelectorPresenter','App\Presenters\MultiSelectorPresenter')
{!! $multiSelectorPresenter->render('goods_label_system_tags','系统标签 :','',$systemTagsForXmSelect,['width'=>'400px']) !!}
</div>
</div>
<blockquote
class=
"layui-elem-quote layui-text"
>
<b>
已经设置的数据
</b>
</blockquote>
<div
class=
"layui-form-item"
>
<div
class=
"layui-input-block"
style=
"margin-left: -30px"
>
<table
class=
"layui-table"
>
<thead>
<tr>
<th>
显示类型
</th>
<th>
系统标签
</th>
</tr>
</thead>
<tbody>
@foreach($goodsLabelSystemTagList as $key=>$item)
<tr>
<td>
{{config('field.SkuGoodsLabel')[$key]}}
</td>
<td>
{{implode(',', $item['system_tags'])}}
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
<!-- 按SKU接入方式选项卡 -->
<div
class=
"layui-tab-item"
>
<blockquote
class=
"layui-elem-quote layui-text"
>
<b>
设置显示类型
</b>
</blockquote>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label
"
>
系统标签 :
</label>
<div
class=
"layui-input-block"
style=
"margin-top: 15px"
>
<div
id=
"sku_tags_selector"
class=
"layui-input-inline"
style=
"width: 100%;"
>
<div
class=
"layui-inline
"
>
@inject('statusPresenter','App\Presenters\StatusPresenter')
{!! $statusPresenter->render('goods_source','SKU接入方式 : ',null,
config('field.SkuSource'),['required'=>true,'label_width'=>'100px']) !!}
</div>
<input
type=
"hidden"
name=
"sku_tags"
id=
"sku_tags"
>
</div>
<span
style=
"margin-left: 110px;color: red"
>
选择标签会覆盖原有标签.如果没有选择任何标签点击确认将把原标签全部删除
</span>
<div
class=
"layui-form-item"
style=
"margin-left: 20px;"
>
<div
class=
"layui-inline"
>
@inject('multiSelectorPresenter','App\Presenters\MultiSelectorPresenter')
{!! $multiSelectorPresenter->render('goods_source_system_tags','系统标签 :','',$systemTagsForXmSelect,['width'=>'400px']) !!}
</div>
</div>
<blockquote
class=
"layui-elem-quote layui-text"
>
<b>
已经设置的数据
</b>
</blockquote>
<div
class=
"layui-form-item"
>
<table
class=
"layui-table"
>
<thead>
<tr>
<th>
显示类型
</th>
<th>
系统标签
</th>
</tr>
</thead>
<tbody>
@foreach($goodsSourceSystemTagList as $key=>$item)
<tr>
<td>
{{config('field.SkuSource')[$key]}}
</td>
<td>
{{implode(',', $item['system_tags'])}}
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
<div
align=
"center"
style=
"margin-top: 10px;text-align: right"
>
<button
type=
"button"
class=
"layui-btn layui-btn-sm layui-btn-info submit-loading"
lay-submit
lay-filter=
"addSkuTag"
>
确认
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-sm layui-btn-primary"
lay-submit
lay-filter=
"cancel"
>
取消
</button>
</div>
</div>
<div
class=
"layui-form-item"
style=
"text-align: right; margin-top: 30px;"
>
<button
type=
"button"
class=
"layui-btn layui-btn-sm layui-btn-normal submit-loading"
lay-submit
lay-filter=
"addSkuTag"
>
<i
class=
"layui-icon layui-icon-ok"
></i>
确认
</button>
<button
type=
"button"
class=
"layui-btn layui-btn-sm layui-btn-primary"
lay-submit
lay-filter=
"cancel"
>
<i
class=
"layui-icon layui-icon-close"
></i>
取消
</button>
</div>
</div>
</form>
resources/views/web/SupplierDetail.blade.php
View file @
90ac87a5
...
...
@@ -509,6 +509,12 @@
</div>
</div>
</div>
<div
class=
"layui-inline"
>
@inject('multiSelectorPresenter','App\Presenters\MultiSelectorPresenter')
{!! $multiSelectorPresenter->render('sku_optional_batch','SKU可选批次 : ',!empty($supplier)?$supplier['sku_optional_batch']:'',$sku_optional_batch_for_xm_select,['width'=>'350px','required'=>true,'disable'=>true]) !!}
</div>
<br>
@include('web.supplier.SkuUploadStatus');
<hr>
</div>
...
...
resources/views/web/supplier/SkuRuler.blade.php
View file @
90ac87a5
...
...
@@ -28,12 +28,7 @@
$ruler = array_get(config('fixed.SkuUploadRuler'),$key);
@endphp
@if(!empty($ruler)
&&
strpos($key,'futures')===false)
<input
type=
"checkbox"
name=
"sku_upload_ruler[{{$key}}]"
lay-skin=
"primary"
@
if
($
flag
)
checked
@
endif
title=
"{{array_get(config('fixed.SkuUploadRuler'),$key)}}"
>
<input
type=
"checkbox"
name=
"sku_upload_ruler[{{$key}}]"
lay-skin=
"primary"
@
if
($
flag
)
checked
@
endif
title=
"{{array_get(config('fixed.SkuUploadRuler'),$key)}}"
>
@endif
@endforeach
</div>
...
...
@@ -44,12 +39,7 @@
$ruler = array_get(config('fixed.SkuUploadRuler'),$key);
@endphp
@if(!empty($ruler)
&&
strpos($key,'futures')!==false)
<input
type=
"checkbox"
name=
"sku_upload_ruler[{{$key}}]"
lay-skin=
"primary"
@
if
($
flag
)
checked
@
endif
title=
"{{array_get(config('fixed.SkuUploadRuler'),$key)}}"
>
<input
type=
"checkbox"
name=
"sku_upload_ruler[{{$key}}]"
lay-skin=
"primary"
@
if
($
flag
)
checked
@
endif
title=
"{{array_get(config('fixed.SkuUploadRuler'),$key)}}"
>
@endif
@endforeach
</div>
...
...
@@ -61,9 +51,7 @@
$ruler = array_get(config('fixed.SkuUploadRuler'),$key);
@endphp
@if(!empty($ruler)
&&
strpos($key,'futures')===false)
<input
type=
"checkbox"
name=
"sku_upload_ruler[{{$key}}]"
lay-skin=
"primary"
title=
"{{$flag}}"
>
<input
type=
"checkbox"
name=
"sku_upload_ruler[{{$key}}]"
lay-skin=
"primary"
title=
"{{$flag}}"
>
@endif
@endforeach
</div>
...
...
@@ -74,9 +62,7 @@
$ruler = array_get(config('fixed.SkuUploadRuler'),$key);
@endphp
@if(!empty($ruler)
&&
strpos($key,'futures')!==false)
<input
type=
"checkbox"
name=
"sku_upload_ruler[{{$key}}]"
lay-skin=
"primary"
title=
"{{$flag}}"
>
<input
type=
"checkbox"
name=
"sku_upload_ruler[{{$key}}]"
lay-skin=
"primary"
title=
"{{$flag}}"
>
@endif
@endforeach
</div>
...
...
@@ -92,33 +78,27 @@
<div
class=
"layui-inline"
style=
"width: 100%"
>
<label
class=
"layui-form-label"
>
审核内容配置 :
</label>
<div
class=
"layui-input-inline"
style=
"width: 205px"
>
<input
type=
"radio"
name=
"sku_audit_ruler[skip]"
lay-filter=
"is_skip"
@
if
($
supplier
['
sku_audit_ruler
']['
skip
']==
1
)
checked
@
endif
value=
"1"
title=
"无需审核"
>
<input
type=
"radio"
name=
"sku_audit_ruler[skip]"
lay-filter=
"is_skip"
@
if
($
supplier
['
sku_audit_ruler
']['
skip
']==
0
)
checked
@
endif
value=
"0"
title=
"需要审核内容"
>
<input
type=
"radio"
name=
"sku_audit_ruler[skip]"
lay-filter=
"is_skip"
@
if
($
supplier
['
sku_audit_ruler
']['
skip
']==
1
)
checked
@
endif
value=
"1"
title=
"无需审核"
>
<input
type=
"radio"
name=
"sku_audit_ruler[skip]"
lay-filter=
"is_skip"
@
if
($
supplier
['
sku_audit_ruler
']['
skip
']==
0
)
checked
@
endif
value=
"0"
title=
"需要审核内容"
>
</div>
<div
class=
"layui-input-inline"
style=
"width: 700px"
>
@if(!empty($supplier['sku_audit_ruler']))
@foreach($supplier['sku_audit_ruler']['audit_ruler'] as $key=>$flag)
@if(!empty(array_get(config('fixed.SkuAuditRuler.audit_ruler'),$key)))
<input
type=
"checkbox"
name=
"sku_audit_ruler[{{$key}}]"
lay-skin=
"primary"
class=
"audit_ruler_item"
@
if
($
flag
)
checked
@
endif
title=
"{{array_get(config('fixed.SkuAuditRuler.name_map'),$key)}}"
>
<input
type=
"checkbox"
name=
"sku_audit_ruler[{{$key}}]"
lay-skin=
"primary"
class=
"audit_ruler_item"
@
if
($
flag
)
checked
@
endif
title=
"{{array_get(config('fixed.SkuAuditRuler.name_map'),$key)}}"
>
@endif
@endforeach
@else
@foreach(config('fixed.SkuAuditRuler.audit_ruler') as $key=>$flag)
<input
type=
"checkbox"
name=
"sku_audit_ruler[{{$key}}]"
lay-skin=
"primary"
checked
class=
"audit_ruler_item"
title=
"{{array_get(config('fixed.SkuAuditRuler.name_map'),$key)}}"
>
<input
type=
"checkbox"
name=
"sku_audit_ruler[{{$key}}]"
lay-skin=
"primary"
checked
class=
"audit_ruler_item"
title=
"{{array_get(config('fixed.SkuAuditRuler.name_map'),$key)}}"
>
@endforeach
@endif
</div>
</div>
<div
class=
"layui-inline"
>
@inject('multiSelectorPresenter','App\Presenters\MultiSelectorPresenter')
{!! $multiSelectorPresenter->render('sku_optional_batch','SKU可选批次 : ',!empty($supplier)?$supplier['sku_optional_batch']:'',$sku_optional_batch_for_xm_select,['width'=>'350px','required'=>true]) !!}
</div>
@include('web.supplier.SkuUploadStatus');
</div>
...
...
vendor/_laravel_ide/discover-1e7ea3cf42a2f9b84f3de09530e2c135.php
deleted
100644 → 0
View file @
81a5362d
<?php
error_reporting
(
E_ERROR
|
E_PARSE
);
define
(
'LARAVEL_START'
,
microtime
(
true
));
require_once
__DIR__
.
'/../autoload.php'
;
class
LaravelVsCode
{
public
static
function
relativePath
(
$path
)
{
if
(
!
str_contains
(
$path
,
base_path
()))
{
return
(
string
)
$path
;
}
return
ltrim
(
str_replace
(
base_path
(),
''
,
realpath
(
$path
)
?:
$path
),
DIRECTORY_SEPARATOR
);
}
public
static
function
isVendor
(
$path
)
{
return
str_contains
(
$path
,
base_path
(
"vendor"
));
}
public
static
function
outputMarker
(
$key
)
{
return
'__VSCODE_LARAVEL_'
.
$key
.
'__'
;
}
public
static
function
startupError
(
\Throwable
$e
)
{
throw
new
Error
(
self
::
outputMarker
(
'STARTUP_ERROR'
)
.
': '
.
$e
->
getMessage
());
}
}
try
{
$app
=
require_once
__DIR__
.
'/../../bootstrap/app.php'
;
}
catch
(
\Throwable
$e
)
{
LaravelVsCode
::
startupError
(
$e
);
exit
(
1
);
}
$app
->
register
(
new
class
($
app
)
extends
\Illuminate\Support\ServiceProvider
{
public
function
boot
()
{
config
([
'logging.channels.null'
=>
[
'driver'
=>
'monolog'
,
'handler'
=>
\Monolog\Handler\NullHandler
::
class
,
],
'logging.default'
=>
'null'
,
]);
}
});
try
{
$kernel
=
$app
->
make
(
Illuminate\Contracts\Console\Kernel
::
class
);
$kernel
->
bootstrap
();
}
catch
(
\Throwable
$e
)
{
LaravelVsCode
::
startupError
(
$e
);
exit
(
1
);
}
echo
LaravelVsCode
::
outputMarker
(
'START_OUTPUT'
);
$routes
=
new
class
{
public
function
all
()
{
return
collect
(
app
(
'router'
)
->
getRoutes
()
->
getRoutes
())
->
map
(
fn
(
\Illuminate\Routing\Route
$route
)
=>
$this
->
getRoute
(
$route
))
->
merge
(
$this
->
getFolioRoutes
());
}
protected
function
getFolioRoutes
()
{
try
{
$output
=
new
\Symfony\Component\Console\Output\BufferedOutput
();
\Illuminate\Support\Facades\Artisan
::
call
(
"folio:list"
,
[
"--json"
=>
true
],
$output
);
$mountPaths
=
collect
(
app
(
\Laravel\Folio\FolioManager
::
class
)
->
mountPaths
());
return
collect
(
json_decode
(
$output
->
fetch
(),
true
))
->
map
(
fn
(
$route
)
=>
$this
->
getFolioRoute
(
$route
,
$mountPaths
));
}
catch
(
\Exception
|
\Throwable
$e
)
{
return
[];
}
}
protected
function
getFolioRoute
(
$route
,
$mountPaths
)
{
if
(
$mountPaths
->
count
()
===
1
)
{
$mountPath
=
$mountPaths
[
0
];
}
else
{
$mountPath
=
$mountPaths
->
first
(
fn
(
$mp
)
=>
file_exists
(
$mp
->
path
.
DIRECTORY_SEPARATOR
.
$route
[
'view'
]));
}
$path
=
$route
[
'view'
];
if
(
$mountPath
)
{
$path
=
$mountPath
->
path
.
DIRECTORY_SEPARATOR
.
$path
;
}
return
[
'method'
=>
$route
[
'method'
],
'uri'
=>
$route
[
'uri'
],
'name'
=>
$route
[
'name'
],
'action'
=>
null
,
'parameters'
=>
[],
'filename'
=>
$path
,
'line'
=>
0
,
];
}
protected
function
getRoute
(
\Illuminate\Routing\Route
$route
)
{
try
{
$reflection
=
$this
->
getRouteReflection
(
$route
);
}
catch
(
\Throwable
$e
)
{
$reflection
=
null
;
}
return
[
'method'
=>
collect
(
$route
->
methods
())
->
filter
(
fn
(
$method
)
=>
$method
!==
'HEAD'
)
->
implode
(
'|'
),
'uri'
=>
$route
->
uri
(),
'name'
=>
$route
->
getName
(),
'action'
=>
$route
->
getActionName
(),
'parameters'
=>
$route
->
parameterNames
(),
'filename'
=>
$reflection
?
$reflection
->
getFileName
()
:
null
,
'line'
=>
$reflection
?
$reflection
->
getStartLine
()
:
null
,
];
}
protected
function
getRouteReflection
(
\Illuminate\Routing\Route
$route
)
{
if
(
$route
->
getActionName
()
===
'Closure'
)
{
return
new
\ReflectionFunction
(
$route
->
getAction
()[
'uses'
]);
}
if
(
!
str_contains
(
$route
->
getActionName
(),
'@'
))
{
return
new
\ReflectionClass
(
$route
->
getActionName
());
}
try
{
return
new
\ReflectionMethod
(
$route
->
getControllerClass
(),
$route
->
getActionMethod
());
}
catch
(
\Throwable
$e
)
{
$namespace
=
app
(
\Illuminate\Routing\UrlGenerator
::
class
)
->
getRootControllerNamespace
()
??
(
app
()
->
getNamespace
()
.
'Http\Controllers'
);
return
new
\ReflectionMethod
(
$namespace
.
'\\'
.
ltrim
(
$route
->
getControllerClass
(),
'\\'
),
$route
->
getActionMethod
(),
);
}
}
};
echo
$routes
->
all
()
->
toJson
();
echo
LaravelVsCode
::
outputMarker
(
'END_OUTPUT'
);
exit
(
0
);
vendor/_laravel_ide/discover-31b934f114eabc246b541addb8b458e3.php
deleted
100644 → 0
View file @
81a5362d
<?php
error_reporting
(
E_ERROR
|
E_PARSE
);
define
(
'LARAVEL_START'
,
microtime
(
true
));
require_once
__DIR__
.
'/../autoload.php'
;
class
LaravelVsCode
{
public
static
function
relativePath
(
$path
)
{
if
(
!
str_contains
(
$path
,
base_path
()))
{
return
(
string
)
$path
;
}
return
ltrim
(
str_replace
(
base_path
(),
''
,
realpath
(
$path
)
?:
$path
),
DIRECTORY_SEPARATOR
);
}
public
static
function
isVendor
(
$path
)
{
return
str_contains
(
$path
,
base_path
(
"vendor"
));
}
public
static
function
outputMarker
(
$key
)
{
return
'__VSCODE_LARAVEL_'
.
$key
.
'__'
;
}
public
static
function
startupError
(
\Throwable
$e
)
{
throw
new
Error
(
self
::
outputMarker
(
'STARTUP_ERROR'
)
.
': '
.
$e
->
getMessage
());
}
}
try
{
$app
=
require_once
__DIR__
.
'/../../bootstrap/app.php'
;
}
catch
(
\Throwable
$e
)
{
LaravelVsCode
::
startupError
(
$e
);
exit
(
1
);
}
$app
->
register
(
new
class
($
app
)
extends
\Illuminate\Support\ServiceProvider
{
public
function
boot
()
{
config
([
'logging.channels.null'
=>
[
'driver'
=>
'monolog'
,
'handler'
=>
\Monolog\Handler\NullHandler
::
class
,
],
'logging.default'
=>
'null'
,
]);
}
});
try
{
$kernel
=
$app
->
make
(
Illuminate\Contracts\Console\Kernel
::
class
);
$kernel
->
bootstrap
();
}
catch
(
\Throwable
$e
)
{
LaravelVsCode
::
startupError
(
$e
);
exit
(
1
);
}
echo
LaravelVsCode
::
outputMarker
(
'START_OUTPUT'
);
echo
collect
(
app
()
->
getBindings
())
->
filter
(
fn
(
$binding
)
=>
(
$binding
[
'concrete'
]
??
null
)
!==
null
)
->
flatMap
(
function
(
$binding
,
$key
)
{
$boundTo
=
new
ReflectionFunction
(
$binding
[
'concrete'
]);
$closureClass
=
$boundTo
->
getClosureScopeClass
();
if
(
$closureClass
===
null
)
{
return
[];
}
return
[
$key
=>
[
'path'
=>
LaravelVsCode
::
relativePath
(
$closureClass
->
getFileName
()),
'class'
=>
$closureClass
->
getName
(),
'line'
=>
$boundTo
->
getStartLine
(),
],
];
})
->
toJson
();
echo
LaravelVsCode
::
outputMarker
(
'END_OUTPUT'
);
exit
(
0
);
vendor/_laravel_ide/discover-320fe5c5b7f0175eae37c44f264ceb08.php
deleted
100644 → 0
View file @
81a5362d
<?php
error_reporting
(
E_ERROR
|
E_PARSE
);
define
(
'LARAVEL_START'
,
microtime
(
true
));
require_once
__DIR__
.
'/../autoload.php'
;
class
LaravelVsCode
{
public
static
function
relativePath
(
$path
)
{
if
(
!
str_contains
(
$path
,
base_path
()))
{
return
(
string
)
$path
;
}
return
ltrim
(
str_replace
(
base_path
(),
''
,
realpath
(
$path
)
?:
$path
),
DIRECTORY_SEPARATOR
);
}
public
static
function
isVendor
(
$path
)
{
return
str_contains
(
$path
,
base_path
(
"vendor"
));
}
public
static
function
outputMarker
(
$key
)
{
return
'__VSCODE_LARAVEL_'
.
$key
.
'__'
;
}
public
static
function
startupError
(
\Throwable
$e
)
{
throw
new
Error
(
self
::
outputMarker
(
'STARTUP_ERROR'
)
.
': '
.
$e
->
getMessage
());
}
}
try
{
$app
=
require_once
__DIR__
.
'/../../bootstrap/app.php'
;
}
catch
(
\Throwable
$e
)
{
LaravelVsCode
::
startupError
(
$e
);
exit
(
1
);
}
$app
->
register
(
new
class
($
app
)
extends
\Illuminate\Support\ServiceProvider
{
public
function
boot
()
{
config
([
'logging.channels.null'
=>
[
'driver'
=>
'monolog'
,
'handler'
=>
\Monolog\Handler\NullHandler
::
class
,
],
'logging.default'
=>
'null'
,
]);
}
});
try
{
$kernel
=
$app
->
make
(
Illuminate\Contracts\Console\Kernel
::
class
);
$kernel
->
bootstrap
();
}
catch
(
\Throwable
$e
)
{
LaravelVsCode
::
startupError
(
$e
);
exit
(
1
);
}
echo
LaravelVsCode
::
outputMarker
(
'START_OUTPUT'
);
echo
json_encode
([
...
config
(
'inertia.testing'
,
[]),
'page_paths'
=>
collect
(
config
(
'inertia.testing.page_paths'
,
[]))
->
flatMap
(
function
(
$path
)
{
$relativePath
=
LaravelVsCode
::
relativePath
(
$path
);
return
[
$relativePath
,
mb_strtolower
(
$relativePath
)];
})
->
unique
()
->
values
(),
]);
echo
LaravelVsCode
::
outputMarker
(
'END_OUTPUT'
);
exit
(
0
);
vendor/_laravel_ide/discover-476fe65492650d7ce55de1f8f96024c5.php
deleted
100644 → 0
View file @
81a5362d
<?php
error_reporting
(
E_ERROR
|
E_PARSE
);
define
(
'LARAVEL_START'
,
microtime
(
true
));
require_once
__DIR__
.
'/../autoload.php'
;
class
LaravelVsCode
{
public
static
function
relativePath
(
$path
)
{
if
(
!
str_contains
(
$path
,
base_path
()))
{
return
(
string
)
$path
;
}
return
ltrim
(
str_replace
(
base_path
(),
''
,
realpath
(
$path
)
?:
$path
),
DIRECTORY_SEPARATOR
);
}
public
static
function
isVendor
(
$path
)
{
return
str_contains
(
$path
,
base_path
(
"vendor"
));
}
public
static
function
outputMarker
(
$key
)
{
return
'__VSCODE_LARAVEL_'
.
$key
.
'__'
;
}
public
static
function
startupError
(
\Throwable
$e
)
{
throw
new
Error
(
self
::
outputMarker
(
'STARTUP_ERROR'
)
.
': '
.
$e
->
getMessage
());
}
}
try
{
$app
=
require_once
__DIR__
.
'/../../bootstrap/app.php'
;
}
catch
(
\Throwable
$e
)
{
LaravelVsCode
::
startupError
(
$e
);
exit
(
1
);
}
$app
->
register
(
new
class
($
app
)
extends
\Illuminate\Support\ServiceProvider
{
public
function
boot
()
{
config
([
'logging.channels.null'
=>
[
'driver'
=>
'monolog'
,
'handler'
=>
\Monolog\Handler\NullHandler
::
class
,
],
'logging.default'
=>
'null'
,
]);
}
});
try
{
$kernel
=
$app
->
make
(
Illuminate\Contracts\Console\Kernel
::
class
);
$kernel
->
bootstrap
();
}
catch
(
\Throwable
$e
)
{
LaravelVsCode
::
startupError
(
$e
);
exit
(
1
);
}
echo
LaravelVsCode
::
outputMarker
(
'START_OUTPUT'
);
echo
json_encode
([
'php_version'
=>
phpversion
(),
'laravel_version'
=>
app
()
->
version
(),
]);
echo
LaravelVsCode
::
outputMarker
(
'END_OUTPUT'
);
exit
(
0
);
vendor/_laravel_ide/discover-5802e590a92e23606bb54d2909564178.php
deleted
100644 → 0
View file @
81a5362d
<?php
error_reporting
(
E_ERROR
|
E_PARSE
);
define
(
'LARAVEL_START'
,
microtime
(
true
));
require_once
__DIR__
.
'/../autoload.php'
;
class
LaravelVsCode
{
public
static
function
relativePath
(
$path
)
{
if
(
!
str_contains
(
$path
,
base_path
()))
{
return
(
string
)
$path
;
}
return
ltrim
(
str_replace
(
base_path
(),
''
,
realpath
(
$path
)
?:
$path
),
DIRECTORY_SEPARATOR
);
}
public
static
function
isVendor
(
$path
)
{
return
str_contains
(
$path
,
base_path
(
"vendor"
));
}
public
static
function
outputMarker
(
$key
)
{
return
'__VSCODE_LARAVEL_'
.
$key
.
'__'
;
}
public
static
function
startupError
(
\Throwable
$e
)
{
throw
new
Error
(
self
::
outputMarker
(
'STARTUP_ERROR'
)
.
': '
.
$e
->
getMessage
());
}
}
try
{
$app
=
require_once
__DIR__
.
'/../../bootstrap/app.php'
;
}
catch
(
\Throwable
$e
)
{
LaravelVsCode
::
startupError
(
$e
);
exit
(
1
);
}
$app
->
register
(
new
class
($
app
)
extends
\Illuminate\Support\ServiceProvider
{
public
function
boot
()
{
config
([
'logging.channels.null'
=>
[
'driver'
=>
'monolog'
,
'handler'
=>
\Monolog\Handler\NullHandler
::
class
,
],
'logging.default'
=>
'null'
,
]);
}
});
try
{
$kernel
=
$app
->
make
(
Illuminate\Contracts\Console\Kernel
::
class
);
$kernel
->
bootstrap
();
}
catch
(
\Throwable
$e
)
{
LaravelVsCode
::
startupError
(
$e
);
exit
(
1
);
}
echo
LaravelVsCode
::
outputMarker
(
'START_OUTPUT'
);
echo
json_encode
([
[
'key'
=>
'base_path'
,
'path'
=>
base_path
(),
],
[
'key'
=>
'resource_path'
,
'path'
=>
resource_path
(),
],
[
'key'
=>
'config_path'
,
'path'
=>
config_path
(),
],
[
'key'
=>
'app_path'
,
'path'
=>
app_path
(),
],
[
'key'
=>
'database_path'
,
'path'
=>
database_path
(),
],
[
'key'
=>
'lang_path'
,
'path'
=>
lang_path
(),
],
[
'key'
=>
'public_path'
,
'path'
=>
public_path
(),
],
[
'key'
=>
'storage_path'
,
'path'
=>
storage_path
(),
],
]);
echo
LaravelVsCode
::
outputMarker
(
'END_OUTPUT'
);
exit
(
0
);
vendor/_laravel_ide/discover-67043687ec5f16a5c4357b3dc049d2d5.php
deleted
100644 → 0
View file @
81a5362d
<?php
error_reporting
(
E_ERROR
|
E_PARSE
);
define
(
'LARAVEL_START'
,
microtime
(
true
));
require_once
__DIR__
.
'/../autoload.php'
;
class
LaravelVsCode
{
public
static
function
relativePath
(
$path
)
{
if
(
!
str_contains
(
$path
,
base_path
()))
{
return
(
string
)
$path
;
}
return
ltrim
(
str_replace
(
base_path
(),
''
,
realpath
(
$path
)
?:
$path
),
DIRECTORY_SEPARATOR
);
}
public
static
function
isVendor
(
$path
)
{
return
str_contains
(
$path
,
base_path
(
"vendor"
));
}
public
static
function
outputMarker
(
$key
)
{
return
'__VSCODE_LARAVEL_'
.
$key
.
'__'
;
}
public
static
function
startupError
(
\Throwable
$e
)
{
throw
new
Error
(
self
::
outputMarker
(
'STARTUP_ERROR'
)
.
': '
.
$e
->
getMessage
());
}
}
try
{
$app
=
require_once
__DIR__
.
'/../../bootstrap/app.php'
;
}
catch
(
\Throwable
$e
)
{
LaravelVsCode
::
startupError
(
$e
);
exit
(
1
);
}
$app
->
register
(
new
class
($
app
)
extends
\Illuminate\Support\ServiceProvider
{
public
function
boot
()
{
config
([
'logging.channels.null'
=>
[
'driver'
=>
'monolog'
,
'handler'
=>
\Monolog\Handler\NullHandler
::
class
,
],
'logging.default'
=>
'null'
,
]);
}
});
try
{
$kernel
=
$app
->
make
(
Illuminate\Contracts\Console\Kernel
::
class
);
$kernel
->
bootstrap
();
}
catch
(
\Throwable
$e
)
{
LaravelVsCode
::
startupError
(
$e
);
exit
(
1
);
}
echo
LaravelVsCode
::
outputMarker
(
'START_OUTPUT'
);
$blade
=
new
class
{
public
function
getAllViews
()
{
$finder
=
app
(
"view"
)
->
getFinder
();
$paths
=
collect
(
$finder
->
getPaths
())
->
flatMap
(
fn
(
$path
)
=>
$this
->
findViews
(
$path
));
$hints
=
collect
(
$finder
->
getHints
())
->
flatMap
(
fn
(
$paths
,
$key
)
=>
collect
(
$paths
)
->
flatMap
(
fn
(
$path
)
=>
collect
(
$this
->
findViews
(
$path
))
->
map
(
fn
(
$value
)
=>
array_merge
(
$value
,
[
"key"
=>
"
{
$key
}
::
{
$value
[
"key"
]
}
"
])
)
)
);
[
$local
,
$vendor
]
=
$paths
->
merge
(
$hints
)
->
values
()
->
partition
(
fn
(
$v
)
=>
!
$v
[
"isVendor"
]);
return
$local
->
sortBy
(
"key"
,
SORT_NATURAL
)
->
merge
(
$vendor
->
sortBy
(
"key"
,
SORT_NATURAL
));
}
public
function
getAllComponents
()
{
$namespaced
=
\Illuminate\Support\Facades\Blade
::
getClassComponentNamespaces
();
$autoloaded
=
require
base_path
(
"vendor/composer/autoload_psr4.php"
);
$components
=
[];
foreach
(
$namespaced
as
$key
=>
$ns
)
{
$path
=
null
;
foreach
(
$autoloaded
as
$namespace
=>
$paths
)
{
if
(
str_starts_with
(
$ns
,
$namespace
))
{
foreach
(
$paths
as
$p
)
{
$test
=
str
(
$ns
)
->
replace
(
$namespace
,
''
)
->
replace
(
'\\'
,
'/'
)
->
prepend
(
$p
.
DIRECTORY_SEPARATOR
)
->
toString
();
if
(
is_dir
(
$test
))
{
$path
=
$test
;
break
;
}
}
break
;
}
}
if
(
!
$path
)
{
continue
;
}
$files
=
\Symfony\Component\Finder\Finder
::
create
()
->
files
()
->
name
(
"*.php"
)
->
in
(
$path
);
foreach
(
$files
as
$file
)
{
$realPath
=
$file
->
getRealPath
();
$components
[]
=
[
"path"
=>
str_replace
(
base_path
(
DIRECTORY_SEPARATOR
),
''
,
$realPath
),
"isVendor"
=>
str_contains
(
$realPath
,
base_path
(
"vendor"
)),
"key"
=>
str
(
$realPath
)
->
replace
(
realpath
(
$path
),
""
)
->
replace
(
".php"
,
""
)
->
ltrim
(
DIRECTORY_SEPARATOR
)
->
replace
(
DIRECTORY_SEPARATOR
,
"."
)
->
kebab
()
->
prepend
(
$key
.
"::"
),
];
}
}
return
$components
;
}
protected
function
findViews
(
$path
)
{
$paths
=
[];
if
(
!
is_dir
(
$path
))
{
return
$paths
;
}
$files
=
\Symfony\Component\Finder\Finder
::
create
()
->
files
()
->
name
(
"*.blade.php"
)
->
in
(
$path
);
foreach
(
$files
as
$file
)
{
$paths
[]
=
[
"path"
=>
str_replace
(
base_path
(
DIRECTORY_SEPARATOR
),
''
,
$file
->
getRealPath
()),
"isVendor"
=>
str_contains
(
$file
->
getRealPath
(),
base_path
(
"vendor"
)),
"key"
=>
str
(
$file
->
getRealPath
())
->
replace
(
realpath
(
$path
),
""
)
->
replace
(
".blade.php"
,
""
)
->
ltrim
(
DIRECTORY_SEPARATOR
)
->
replace
(
DIRECTORY_SEPARATOR
,
"."
)
];
}
return
$paths
;
}
};
echo
json_encode
(
$blade
->
getAllViews
()
->
merge
(
$blade
->
getAllComponents
()));
echo
LaravelVsCode
::
outputMarker
(
'END_OUTPUT'
);
exit
(
0
);
vendor/_laravel_ide/discover-7563160ca998bde672640aa1e68dfd08.php
deleted
100644 → 0
View file @
81a5362d
<?php
error_reporting
(
E_ERROR
|
E_PARSE
);
define
(
'LARAVEL_START'
,
microtime
(
true
));
require_once
__DIR__
.
'/../autoload.php'
;
class
LaravelVsCode
{
public
static
function
relativePath
(
$path
)
{
if
(
!
str_contains
(
$path
,
base_path
()))
{
return
(
string
)
$path
;
}
return
ltrim
(
str_replace
(
base_path
(),
''
,
realpath
(
$path
)
?:
$path
),
DIRECTORY_SEPARATOR
);
}
public
static
function
isVendor
(
$path
)
{
return
str_contains
(
$path
,
base_path
(
"vendor"
));
}
public
static
function
outputMarker
(
$key
)
{
return
'__VSCODE_LARAVEL_'
.
$key
.
'__'
;
}
public
static
function
startupError
(
\Throwable
$e
)
{
throw
new
Error
(
self
::
outputMarker
(
'STARTUP_ERROR'
)
.
': '
.
$e
->
getMessage
());
}
}
try
{
$app
=
require_once
__DIR__
.
'/../../bootstrap/app.php'
;
}
catch
(
\Throwable
$e
)
{
LaravelVsCode
::
startupError
(
$e
);
exit
(
1
);
}
$app
->
register
(
new
class
($
app
)
extends
\Illuminate\Support\ServiceProvider
{
public
function
boot
()
{
config
([
'logging.channels.null'
=>
[
'driver'
=>
'monolog'
,
'handler'
=>
\Monolog\Handler\NullHandler
::
class
,
],
'logging.default'
=>
'null'
,
]);
}
});
try
{
$kernel
=
$app
->
make
(
Illuminate\Contracts\Console\Kernel
::
class
);
$kernel
->
bootstrap
();
}
catch
(
\Throwable
$e
)
{
LaravelVsCode
::
startupError
(
$e
);
exit
(
1
);
}
echo
LaravelVsCode
::
outputMarker
(
'START_OUTPUT'
);
echo
collect
(
app
(
\Illuminate\View\Compilers\BladeCompiler
::
class
)
->
getCustomDirectives
())
->
map
(
function
(
$customDirective
,
$name
)
{
if
(
$customDirective
instanceof
\Closure
)
{
return
[
'name'
=>
$name
,
'hasParams'
=>
(
new
ReflectionFunction
(
$customDirective
))
->
getNumberOfParameters
()
>=
1
,
];
}
if
(
is_array
(
$customDirective
))
{
return
[
'name'
=>
$name
,
'hasParams'
=>
(
new
ReflectionMethod
(
$customDirective
[
0
],
$customDirective
[
1
]))
->
getNumberOfParameters
()
>=
1
,
];
}
return
null
;
})
->
filter
()
->
values
()
->
toJson
();
echo
LaravelVsCode
::
outputMarker
(
'END_OUTPUT'
);
exit
(
0
);
vendor/_laravel_ide/discover-77e9e6a2445455b87d4f4cd834e4e23d.php
deleted
100644 → 0
View file @
81a5362d
<?php
error_reporting
(
E_ERROR
|
E_PARSE
);
define
(
'LARAVEL_START'
,
microtime
(
true
));
require_once
__DIR__
.
'/../autoload.php'
;
class
LaravelVsCode
{
public
static
function
relativePath
(
$path
)
{
if
(
!
str_contains
(
$path
,
base_path
()))
{
return
(
string
)
$path
;
}
return
ltrim
(
str_replace
(
base_path
(),
''
,
realpath
(
$path
)
?:
$path
),
DIRECTORY_SEPARATOR
);
}
public
static
function
isVendor
(
$path
)
{
return
str_contains
(
$path
,
base_path
(
"vendor"
));
}
public
static
function
outputMarker
(
$key
)
{
return
'__VSCODE_LARAVEL_'
.
$key
.
'__'
;
}
public
static
function
startupError
(
\Throwable
$e
)
{
throw
new
Error
(
self
::
outputMarker
(
'STARTUP_ERROR'
)
.
': '
.
$e
->
getMessage
());
}
}
try
{
$app
=
require_once
__DIR__
.
'/../../bootstrap/app.php'
;
}
catch
(
\Throwable
$e
)
{
LaravelVsCode
::
startupError
(
$e
);
exit
(
1
);
}
$app
->
register
(
new
class
($
app
)
extends
\Illuminate\Support\ServiceProvider
{
public
function
boot
()
{
config
([
'logging.channels.null'
=>
[
'driver'
=>
'monolog'
,
'handler'
=>
\Monolog\Handler\NullHandler
::
class
,
],
'logging.default'
=>
'null'
,
]);
}
});
try
{
$kernel
=
$app
->
make
(
Illuminate\Contracts\Console\Kernel
::
class
);
$kernel
->
bootstrap
();
}
catch
(
\Throwable
$e
)
{
LaravelVsCode
::
startupError
(
$e
);
exit
(
1
);
}
echo
LaravelVsCode
::
outputMarker
(
'START_OUTPUT'
);
if
(
class_exists
(
'\phpDocumentor\Reflection\DocBlockFactory'
))
{
$factory
=
\phpDocumentor\Reflection\DocBlockFactory
::
createInstance
();
}
else
{
$factory
=
null
;
}
$docblocks
=
new
class
($
factory
)
{
public
function
__construct
(
protected
$factory
)
{}
public
function
forMethod
(
$method
)
{
if
(
$this
->
factory
!==
null
)
{
$docblock
=
$this
->
factory
->
create
(
$method
->
getDocComment
());
$params
=
collect
(
$docblock
->
getTagsByName
(
"param"
))
->
map
(
fn
(
$p
)
=>
(
string
)
$p
)
->
all
();
$return
=
(
string
)
$docblock
->
getTagsByName
(
"return"
)[
0
]
??
null
;
return
[
$params
,
$return
];
}
$params
=
collect
(
$method
->
getParameters
())
->
map
(
function
(
\ReflectionParameter
$param
)
{
$types
=
match
(
$param
?->
getType
())
{
null
=>
[],
default
=>
method_exists
(
$param
->
getType
(),
"getTypes"
)
?
$param
->
getType
()
->
getTypes
()
:
[
$param
->
getType
()]
};
$types
=
collect
(
$types
)
->
filter
()
->
values
()
->
map
(
fn
(
$t
)
=>
$t
->
getName
());
return
trim
(
$types
->
join
(
"|"
)
.
" $"
.
$param
->
getName
());
})
->
all
();
$return
=
$method
->
getReturnType
()
?->
getName
();
return
[
$params
,
$return
];
}
};
$models
=
new
class
($
factory
)
{
protected
$output
;
public
function
__construct
(
protected
$factory
)
{
$this
->
output
=
new
\Symfony\Component\Console\Output\BufferedOutput
();
}
public
function
all
()
{
collect
(
glob
(
base_path
(
'**/Models/*.php'
)))
->
each
(
fn
(
$file
)
=>
include_once
(
$file
));
return
collect
(
get_declared_classes
())
->
filter
(
fn
(
$class
)
=>
is_subclass_of
(
$class
,
\Illuminate\Database\Eloquent\Model
::
class
))
->
filter
(
fn
(
$class
)
=>
!
in_array
(
$class
,
[
\Illuminate\Database\Eloquent\Relations\Pivot
::
class
,
\Illuminate\Foundation\Auth\User
::
class
]))
->
values
()
->
flatMap
(
fn
(
string
$className
)
=>
$this
->
getInfo
(
$className
))
->
filter
();
}
protected
function
getCastReturnType
(
$className
)
{
if
(
$className
===
null
)
{
return
null
;
}
try
{
$method
=
(
new
\ReflectionClass
(
$className
))
->
getMethod
(
'get'
);
if
(
$method
->
hasReturnType
())
{
return
$method
->
getReturnType
()
->
getName
();
}
return
$className
;
}
catch
(
\Exception
|
\Throwable
$e
)
{
return
$className
;
}
}
protected
function
fromArtisan
(
$className
)
{
try
{
\Illuminate\Support\Facades\Artisan
::
call
(
"model:show"
,
[
"model"
=>
$className
,
"--json"
=>
true
,
],
$this
->
output
);
}
catch
(
\Exception
|
\Throwable
$e
)
{
return
null
;
}
return
json_decode
(
$this
->
output
->
fetch
(),
true
);
}
protected
function
collectExistingProperties
(
$reflection
)
{
if
(
$this
->
factory
===
null
)
{
return
collect
();
}
if
(
$comment
=
$reflection
->
getDocComment
())
{
$docblock
=
$this
->
factory
->
create
(
$comment
);
$existingProperties
=
collect
(
$docblock
->
getTagsByName
(
"property"
))
->
map
(
fn
(
$p
)
=>
$p
->
getVariableName
());
$existingReadProperties
=
collect
(
$docblock
->
getTagsByName
(
"property-read"
))
->
map
(
fn
(
$p
)
=>
$p
->
getVariableName
());
return
$existingProperties
->
merge
(
$existingReadProperties
);
}
return
collect
();
}
protected
function
getParentClass
(
\ReflectionClass
$reflection
)
{
if
(
!
$reflection
->
getParentClass
())
{
return
null
;
}
$parent
=
$reflection
->
getParentClass
()
->
getName
();
if
(
$parent
===
\Illuminate\Database\Eloquent\Model
::
class
)
{
return
null
;
}
return
\Illuminate\Support\Str
::
start
(
$parent
,
'\\'
);
}
protected
function
getInfo
(
$className
)
{
if
((
$data
=
$this
->
fromArtisan
(
$className
))
===
null
)
{
return
null
;
}
$reflection
=
new
\ReflectionClass
(
$className
);
$data
[
"extends"
]
=
$this
->
getParentClass
(
$reflection
);
$existingProperties
=
$this
->
collectExistingProperties
(
$reflection
);
$data
[
'attributes'
]
=
collect
(
$data
[
'attributes'
])
->
map
(
fn
(
$attrs
)
=>
array_merge
(
$attrs
,
[
'title_case'
=>
str
(
$attrs
[
'name'
])
->
title
()
->
replace
(
'_'
,
''
)
->
toString
(),
'documented'
=>
$existingProperties
->
contains
(
$attrs
[
'name'
]),
'cast'
=>
$this
->
getCastReturnType
(
$attrs
[
'cast'
])
]))
->
toArray
();
$data
[
'scopes'
]
=
collect
(
$reflection
->
getMethods
())
->
filter
(
fn
(
$method
)
=>!
$method
->
isStatic
()
&&
(
$method
->
getAttributes
(
\Illuminate\Database\Eloquent\Attributes\Scope
::
class
)
||
(
$method
->
isPublic
()
&&
str_starts_with
(
$method
->
name
,
'scope'
))))
->
map
(
fn
(
$method
)
=>
str
(
$method
->
name
)
->
replace
(
'scope'
,
''
)
->
lcfirst
()
->
toString
())
->
values
()
->
toArray
();
$data
[
'uri'
]
=
$reflection
->
getFileName
();
return
[
$className
=>
$data
,
];
}
};
$builder
=
new
class
($
docblocks
)
{
public
function
__construct
(
protected
$docblocks
)
{}
public
function
methods
()
{
$reflection
=
new
\ReflectionClass
(
\Illuminate\Database\Query\Builder
::
class
);
return
collect
(
$reflection
->
getMethods
(
\ReflectionMethod
::
IS_PUBLIC
|
\ReflectionMethod
::
IS_PROTECTED
))
->
filter
(
fn
(
ReflectionMethod
$method
)
=>
!
str_starts_with
(
$method
->
getName
(),
"__"
)
||
(
!
$method
->
isPublic
()
&&
empty
(
$method
->
getAttributes
(
\Illuminate\Database\Eloquent\Attributes\Scope
::
class
))))
->
map
(
fn
(
\ReflectionMethod
$method
)
=>
$this
->
getMethodInfo
(
$method
))
->
filter
()
->
values
();
}
protected
function
getMethodInfo
(
$method
)
{
[
$params
,
$return
]
=
$this
->
docblocks
->
forMethod
(
$method
);
return
[
"name"
=>
$method
->
getName
(),
"parameters"
=>
$params
,
"return"
=>
$return
,
];
}
};
echo
json_encode
([
'builderMethods'
=>
$builder
->
methods
(),
'models'
=>
$models
->
all
(),
]);
echo
LaravelVsCode
::
outputMarker
(
'END_OUTPUT'
);
exit
(
0
);
vendor/_laravel_ide/discover-79de9752f999b6e261cd05abba67a5ce.php
deleted
100644 → 0
View file @
81a5362d
<?php
error_reporting
(
E_ERROR
|
E_PARSE
);
define
(
'LARAVEL_START'
,
microtime
(
true
));
require_once
__DIR__
.
'/../autoload.php'
;
class
LaravelVsCode
{
public
static
function
relativePath
(
$path
)
{
if
(
!
str_contains
(
$path
,
base_path
()))
{
return
(
string
)
$path
;
}
return
ltrim
(
str_replace
(
base_path
(),
''
,
realpath
(
$path
)
?:
$path
),
DIRECTORY_SEPARATOR
);
}
public
static
function
isVendor
(
$path
)
{
return
str_contains
(
$path
,
base_path
(
"vendor"
));
}
public
static
function
outputMarker
(
$key
)
{
return
'__VSCODE_LARAVEL_'
.
$key
.
'__'
;
}
public
static
function
startupError
(
\Throwable
$e
)
{
throw
new
Error
(
self
::
outputMarker
(
'STARTUP_ERROR'
)
.
': '
.
$e
->
getMessage
());
}
}
try
{
$app
=
require_once
__DIR__
.
'/../../bootstrap/app.php'
;
}
catch
(
\Throwable
$e
)
{
LaravelVsCode
::
startupError
(
$e
);
exit
(
1
);
}
$app
->
register
(
new
class
($
app
)
extends
\Illuminate\Support\ServiceProvider
{
public
function
boot
()
{
config
([
'logging.channels.null'
=>
[
'driver'
=>
'monolog'
,
'handler'
=>
\Monolog\Handler\NullHandler
::
class
,
],
'logging.default'
=>
'null'
,
]);
}
});
try
{
$kernel
=
$app
->
make
(
Illuminate\Contracts\Console\Kernel
::
class
);
$kernel
->
bootstrap
();
}
catch
(
\Throwable
$e
)
{
LaravelVsCode
::
startupError
(
$e
);
exit
(
1
);
}
echo
LaravelVsCode
::
outputMarker
(
'START_OUTPUT'
);
function
vsCodeGetReflectionMethod
(
ReflectionClass
$reflected
)
:
ReflectionMethod
{
return
match
(
true
)
{
$reflected
->
hasMethod
(
'__invoke'
)
=>
$reflected
->
getMethod
(
'__invoke'
),
default
=>
$reflected
->
getMethod
(
'handle'
),
};
}
echo
collect
(
app
(
"Illuminate\Contracts\Http\Kernel"
)
->
getMiddlewareGroups
())
->
merge
(
app
(
"Illuminate\Contracts\Http\Kernel"
)
->
getRouteMiddleware
())
->
map
(
function
(
$middleware
,
$key
)
{
$result
=
[
"class"
=>
null
,
"path"
=>
null
,
"line"
=>
null
,
"parameters"
=>
null
,
"groups"
=>
[],
];
if
(
is_array
(
$middleware
))
{
$result
[
"groups"
]
=
collect
(
$middleware
)
->
map
(
function
(
$m
)
{
if
(
!
class_exists
(
$m
))
{
return
[
"class"
=>
$m
,
"path"
=>
null
,
"line"
=>
null
];
}
$reflected
=
new
ReflectionClass
(
$m
);
$reflectedMethod
=
vsCodeGetReflectionMethod
(
$reflected
);
return
[
"class"
=>
$m
,
"path"
=>
LaravelVsCode
::
relativePath
(
$reflected
->
getFileName
()),
"line"
=>
$reflectedMethod
->
getFileName
()
===
$reflected
->
getFileName
()
?
$reflectedMethod
->
getStartLine
()
:
null
];
})
->
all
();
return
$result
;
}
$reflected
=
new
ReflectionClass
(
$middleware
);
$reflectedMethod
=
vsCodeGetReflectionMethod
(
$reflected
);
$result
=
array_merge
(
$result
,
[
"class"
=>
$middleware
,
"path"
=>
LaravelVsCode
::
relativePath
(
$reflected
->
getFileName
()),
"line"
=>
$reflectedMethod
->
getStartLine
(),
]);
$parameters
=
collect
(
$reflectedMethod
->
getParameters
())
->
filter
(
function
(
$rc
)
{
return
$rc
->
getName
()
!==
"request"
&&
$rc
->
getName
()
!==
"next"
;
})
->
map
(
function
(
$rc
)
{
return
$rc
->
getName
()
.
(
$rc
->
isVariadic
()
?
"..."
:
""
);
});
if
(
$parameters
->
isEmpty
())
{
return
$result
;
}
return
array_merge
(
$result
,
[
"parameters"
=>
$parameters
->
implode
(
","
)
]);
})
->
toJson
();
echo
LaravelVsCode
::
outputMarker
(
'END_OUTPUT'
);
exit
(
0
);
vendor/_laravel_ide/discover-9abd86d674d0ba851f4ac7b31349196a.php
deleted
100644 → 0
View file @
81a5362d
<?php
error_reporting
(
E_ERROR
|
E_PARSE
);
define
(
'LARAVEL_START'
,
microtime
(
true
));
require_once
__DIR__
.
'/../autoload.php'
;
class
LaravelVsCode
{
public
static
function
relativePath
(
$path
)
{
if
(
!
str_contains
(
$path
,
base_path
()))
{
return
(
string
)
$path
;
}
return
ltrim
(
str_replace
(
base_path
(),
''
,
realpath
(
$path
)
?:
$path
),
DIRECTORY_SEPARATOR
);
}
public
static
function
isVendor
(
$path
)
{
return
str_contains
(
$path
,
base_path
(
"vendor"
));
}
public
static
function
outputMarker
(
$key
)
{
return
'__VSCODE_LARAVEL_'
.
$key
.
'__'
;
}
public
static
function
startupError
(
\Throwable
$e
)
{
throw
new
Error
(
self
::
outputMarker
(
'STARTUP_ERROR'
)
.
': '
.
$e
->
getMessage
());
}
}
try
{
$app
=
require_once
__DIR__
.
'/../../bootstrap/app.php'
;
}
catch
(
\Throwable
$e
)
{
LaravelVsCode
::
startupError
(
$e
);
exit
(
1
);
}
$app
->
register
(
new
class
($
app
)
extends
\Illuminate\Support\ServiceProvider
{
public
function
boot
()
{
config
([
'logging.channels.null'
=>
[
'driver'
=>
'monolog'
,
'handler'
=>
\Monolog\Handler\NullHandler
::
class
,
],
'logging.default'
=>
'null'
,
]);
}
});
try
{
$kernel
=
$app
->
make
(
Illuminate\Contracts\Console\Kernel
::
class
);
$kernel
->
bootstrap
();
}
catch
(
\Throwable
$e
)
{
LaravelVsCode
::
startupError
(
$e
);
exit
(
1
);
}
echo
LaravelVsCode
::
outputMarker
(
'START_OUTPUT'
);
$components
=
new
class
{
protected
$autoloaded
=
[];
protected
$prefixes
=
[];
public
function
__construct
()
{
$this
->
autoloaded
=
require
base_path
(
"vendor/composer/autoload_psr4.php"
);
}
public
function
all
()
{
$components
=
collect
(
array_merge
(
$this
->
getStandardClasses
(),
$this
->
getStandardViews
(),
$this
->
getNamespaced
(),
$this
->
getAnonymousNamespaced
(),
$this
->
getAnonymous
(),
$this
->
getAliases
(),
$this
->
getVendorComponents
(),
))
->
groupBy
(
'key'
)
->
map
(
fn
(
$items
)
=>
[
'isVendor'
=>
$items
->
first
()[
'isVendor'
],
'paths'
=>
$items
->
pluck
(
'path'
)
->
values
(),
'props'
=>
$items
->
pluck
(
'props'
)
->
values
()
->
filter
()
->
flatMap
(
fn
(
$i
)
=>
$i
),
]);
return
[
'components'
=>
$components
,
'prefixes'
=>
$this
->
prefixes
,
];
}
protected
function
getStandardViews
()
{
$path
=
resource_path
(
'views/components'
);
return
$this
->
findFiles
(
$path
,
'blade.php'
);
}
protected
function
findFiles
(
$path
,
$extension
,
$keyCallback
=
null
)
{
if
(
!
is_dir
(
$path
))
{
return
[];
}
$files
=
\Symfony\Component\Finder\Finder
::
create
()
->
files
()
->
name
(
"*."
.
$extension
)
->
in
(
$path
);
$components
=
[];
$pathRealPath
=
realpath
(
$path
);
foreach
(
$files
as
$file
)
{
$realPath
=
$file
->
getRealPath
();
$key
=
str
(
$realPath
)
->
replace
(
$pathRealPath
,
''
)
->
ltrim
(
'/\\'
)
->
replace
(
'.'
.
$extension
,
''
)
->
replace
([
'/'
,
'\\'
],
'.'
)
->
pipe
(
fn
(
$str
)
=>
$this
->
handleIndexComponents
(
$str
));
$components
[]
=
[
"path"
=>
LaravelVsCode
::
relativePath
(
$realPath
),
"isVendor"
=>
LaravelVsCode
::
isVendor
(
$realPath
),
"key"
=>
$keyCallback
?
$keyCallback
(
$key
)
:
$key
,
];
}
return
$components
;
}
protected
function
getStandardClasses
()
{
$path
=
app_path
(
'View/Components'
);
$appNamespace
=
collect
(
$this
->
autoloaded
)
->
filter
(
fn
(
$paths
)
=>
in_array
(
app_path
(),
$paths
))
->
keys
()
->
first
()
??
''
;
return
collect
(
$this
->
findFiles
(
$path
,
'php'
,
fn
(
$key
)
=>
$key
->
explode
(
'.'
)
->
map
(
fn
(
$p
)
=>
\Illuminate\Support\Str
::
kebab
(
$p
))
->
implode
(
'.'
),
))
->
map
(
function
(
$item
)
use
(
$appNamespace
)
{
$class
=
str
(
$item
[
'path'
])
->
after
(
'View/Components/'
)
->
replace
(
'.php'
,
''
)
->
replace
(
'/'
,
'\\'
)
->
prepend
(
$appNamespace
.
'View\\Components\\'
)
->
toString
();
if
(
!
class_exists
(
$class
))
{
return
$item
;
}
$reflection
=
new
\ReflectionClass
(
$class
);
$parameters
=
collect
(
$reflection
->
getConstructor
()
?->
getParameters
()
??
[])
->
filter
(
fn
(
$p
)
=>
$p
->
isPromoted
())
->
flatMap
(
fn
(
$p
)
=>
[
$p
->
getName
()
=>
$p
->
isOptional
()
?
$p
->
getDefaultValue
()
:
null
])
->
all
();
$props
=
collect
(
$reflection
->
getProperties
())
->
filter
(
fn
(
$p
)
=>
$p
->
isPublic
()
&&
$p
->
getDeclaringClass
()
->
getName
()
===
$class
)
->
map
(
fn
(
$p
)
=>
[
'name'
=>
\Illuminate\Support\Str
::
kebab
(
$p
->
getName
()),
'type'
=>
(
string
)
(
$p
->
getType
()
??
'mixed'
),
'default'
=>
$p
->
getDefaultValue
()
??
$parameters
[
$p
->
getName
()]
??
null
,
]);
[
$except
,
$props
]
=
$props
->
partition
(
fn
(
$p
)
=>
$p
[
'name'
]
===
'except'
);
if
(
$except
->
isNotEmpty
())
{
$except
=
$except
->
first
()[
'default'
];
$props
=
$props
->
reject
(
fn
(
$p
)
=>
in_array
(
$p
[
'name'
],
$except
));
}
return
[
...
$item
,
'props'
=>
$props
,
];
})
->
all
();
}
protected
function
getAliases
()
{
$components
=
[];
foreach
(
\Illuminate\Support\Facades\Blade
::
getClassComponentAliases
()
as
$key
=>
$class
)
{
if
(
class_exists
(
$class
))
{
$reflection
=
new
ReflectionClass
(
$class
);
$components
[]
=
[
"path"
=>
LaravelVsCode
::
relativePath
(
$reflection
->
getFileName
()),
"isVendor"
=>
LaravelVsCode
::
isVendor
(
$reflection
->
getFileName
()),
"key"
=>
$key
,
];
}
}
return
$components
;
}
protected
function
getAnonymousNamespaced
()
{
$components
=
[];
foreach
(
\Illuminate\Support\Facades\Blade
::
getAnonymousComponentNamespaces
()
as
$key
=>
$dir
)
{
$path
=
collect
([
$dir
,
resource_path
(
'views/'
.
$dir
)])
->
first
(
fn
(
$p
)
=>
is_dir
(
$p
));
if
(
!
$path
)
{
continue
;
}
array_push
(
$components
,
...
$this
->
findFiles
(
$path
,
'blade.php'
,
fn
(
$k
)
=>
$k
->
kebab
()
->
prepend
(
$key
.
"::"
),
)
);
}
return
$components
;
}
protected
function
getAnonymous
()
{
$components
=
[];
foreach
(
\Illuminate\Support\Facades\Blade
::
getAnonymousComponentPaths
()
as
$item
)
{
array_push
(
$components
,
...
$this
->
findFiles
(
$item
[
'path'
],
'blade.php'
,
fn
(
$key
)
=>
$key
->
kebab
()
->
prepend
((
$item
[
'prefix'
]
??
':'
)
.
':'
)
->
ltrim
(
':'
),
)
);
if
(
!
in_array
(
$item
[
'prefix'
],
$this
->
prefixes
))
{
$this
->
prefixes
[]
=
$item
[
'prefix'
];
}
}
return
$components
;
}
protected
function
getVendorComponents
()
:
array
{
$components
=
[];
/** @var \Illuminate\View\Factory $view */
$view
=
\Illuminate\Support\Facades\App
::
make
(
'view'
);
/** @var \Illuminate\View\FileViewFinder $finder */
$finder
=
$view
->
getFinder
();
/** @var array<string, array<int, string>> $views */
$views
=
$finder
->
getHints
();
foreach
(
$views
as
$key
=>
$paths
)
{
// First is always optional override in the resources/views folder
$path
=
$paths
[
0
]
.
'/components'
;
if
(
!
is_dir
(
$path
))
{
continue
;
}
array_push
(
$components
,
...
$this
->
findFiles
(
$path
,
'blade.php'
,
fn
(
\Illuminate\Support\Stringable
$k
)
=>
$k
->
kebab
()
->
prepend
(
$key
.
'::'
),
)
);
}
return
$components
;
}
protected
function
handleIndexComponents
(
$str
)
{
if
(
$str
->
endsWith
(
'.index'
))
{
return
$str
->
replaceLast
(
'.index'
,
''
);
}
if
(
!
$str
->
contains
(
'.'
))
{
return
$str
;
}
$parts
=
$str
->
explode
(
'.'
);
if
(
$parts
->
slice
(
-
2
)
->
unique
()
->
count
()
===
1
)
{
$parts
->
pop
();
return
str
(
$parts
->
implode
(
'.'
));
}
return
$str
;
}
protected
function
getNamespaced
()
{
$namespaced
=
\Illuminate\Support\Facades\Blade
::
getClassComponentNamespaces
();
$components
=
[];
foreach
(
$namespaced
as
$key
=>
$classNamespace
)
{
$path
=
$this
->
getNamespacePath
(
$classNamespace
);
if
(
!
$path
)
{
continue
;
}
array_push
(
$components
,
...
$this
->
findFiles
(
$path
,
'php'
,
fn
(
$k
)
=>
$k
->
kebab
()
->
prepend
(
$key
.
"::"
),
)
);
}
return
$components
;
}
protected
function
getNamespacePath
(
$classNamespace
)
{
foreach
(
$this
->
autoloaded
as
$ns
=>
$paths
)
{
if
(
!
str_starts_with
(
$classNamespace
,
$ns
))
{
continue
;
}
foreach
(
$paths
as
$p
)
{
$dir
=
str
(
$classNamespace
)
->
replace
(
$ns
,
''
)
->
replace
(
'\\'
,
'/'
)
->
prepend
(
$p
.
DIRECTORY_SEPARATOR
)
->
toString
();
if
(
is_dir
(
$dir
))
{
return
$dir
;
}
}
return
null
;
}
return
null
;
}
};
echo
json_encode
(
$components
->
all
());
echo
LaravelVsCode
::
outputMarker
(
'END_OUTPUT'
);
exit
(
0
);
vendor/_laravel_ide/discover-d769f81c5eaf96f1f253a56481405376.php
deleted
100644 → 0
View file @
81a5362d
<?php
error_reporting
(
E_ERROR
|
E_PARSE
);
define
(
'LARAVEL_START'
,
microtime
(
true
));
require_once
__DIR__
.
'/../autoload.php'
;
class
LaravelVsCode
{
public
static
function
relativePath
(
$path
)
{
if
(
!
str_contains
(
$path
,
base_path
()))
{
return
(
string
)
$path
;
}
return
ltrim
(
str_replace
(
base_path
(),
''
,
realpath
(
$path
)
?:
$path
),
DIRECTORY_SEPARATOR
);
}
public
static
function
isVendor
(
$path
)
{
return
str_contains
(
$path
,
base_path
(
"vendor"
));
}
public
static
function
outputMarker
(
$key
)
{
return
'__VSCODE_LARAVEL_'
.
$key
.
'__'
;
}
public
static
function
startupError
(
\Throwable
$e
)
{
throw
new
Error
(
self
::
outputMarker
(
'STARTUP_ERROR'
)
.
': '
.
$e
->
getMessage
());
}
}
try
{
$app
=
require_once
__DIR__
.
'/../../bootstrap/app.php'
;
}
catch
(
\Throwable
$e
)
{
LaravelVsCode
::
startupError
(
$e
);
exit
(
1
);
}
$app
->
register
(
new
class
($
app
)
extends
\Illuminate\Support\ServiceProvider
{
public
function
boot
()
{
config
([
'logging.channels.null'
=>
[
'driver'
=>
'monolog'
,
'handler'
=>
\Monolog\Handler\NullHandler
::
class
,
],
'logging.default'
=>
'null'
,
]);
}
});
try
{
$kernel
=
$app
->
make
(
Illuminate\Contracts\Console\Kernel
::
class
);
$kernel
->
bootstrap
();
}
catch
(
\Throwable
$e
)
{
LaravelVsCode
::
startupError
(
$e
);
exit
(
1
);
}
echo
LaravelVsCode
::
outputMarker
(
'START_OUTPUT'
);
$local
=
collect
(
glob
(
config_path
(
"/*.php"
)))
->
merge
(
glob
(
config_path
(
"**/*.php"
)))
->
map
(
fn
(
$path
)
=>
[
(
string
)
str
(
$path
)
->
replace
([
config_path
(
'/'
),
".php"
],
""
)
->
replace
(
DIRECTORY_SEPARATOR
,
"."
),
$path
]);
$vendor
=
collect
(
glob
(
base_path
(
"vendor/**/**/config/*.php"
)))
->
map
(
fn
(
$path
)
=>
[
(
string
)
str
(
$path
)
->
afterLast
(
DIRECTORY_SEPARATOR
.
"config"
.
DIRECTORY_SEPARATOR
)
->
replace
(
".php"
,
""
)
->
replace
(
DIRECTORY_SEPARATOR
,
"."
),
$path
]);
$configPaths
=
$local
->
merge
(
$vendor
)
->
groupBy
(
0
)
->
map
(
fn
(
$items
)
=>
$items
->
pluck
(
1
));
$cachedContents
=
[];
$cachedParsed
=
[];
function
vsCodeGetConfigValue
(
$value
,
$key
,
$configPaths
)
{
$parts
=
explode
(
"."
,
$key
);
$toFind
=
$key
;
$found
=
null
;
while
(
count
(
$parts
)
>
0
)
{
$toFind
=
implode
(
"."
,
$parts
);
if
(
$configPaths
->
has
(
$toFind
))
{
$found
=
$toFind
;
break
;
}
array_pop
(
$parts
);
}
if
(
$found
===
null
)
{
return
null
;
}
$file
=
null
;
$line
=
null
;
if
(
$found
===
$key
)
{
$file
=
$configPaths
->
get
(
$found
)[
0
];
}
else
{
foreach
(
$configPaths
->
get
(
$found
)
as
$path
)
{
$cachedContents
[
$path
]
??=
file_get_contents
(
$path
);
$cachedParsed
[
$path
]
??=
token_get_all
(
$cachedContents
[
$path
]);
$keysToFind
=
str
(
$key
)
->
replaceFirst
(
$found
,
""
)
->
ltrim
(
"."
)
->
explode
(
"."
);
if
(
is_numeric
(
$keysToFind
->
last
()))
{
$index
=
$keysToFind
->
pop
();
if
(
$index
!==
"0"
)
{
return
null
;
}
$key
=
collect
(
explode
(
"."
,
$key
));
$key
->
pop
();
$key
=
$key
->
implode
(
"."
);
$value
=
"array(...)"
;
}
$nextKey
=
$keysToFind
->
shift
();
$expectedDepth
=
1
;
$depth
=
0
;
foreach
(
$cachedParsed
[
$path
]
as
$token
)
{
if
(
$token
===
"["
)
{
$depth
++
;
}
if
(
$token
===
"]"
)
{
$depth
--
;
}
if
(
!
is_array
(
$token
))
{
continue
;
}
$str
=
trim
(
$token
[
1
],
'"\''
);
if
(
$str
===
$nextKey
&&
$depth
===
$expectedDepth
&&
$token
[
0
]
===
T_CONSTANT_ENCAPSED_STRING
)
{
$nextKey
=
$keysToFind
->
shift
();
$expectedDepth
++
;
if
(
$nextKey
===
null
)
{
$file
=
$path
;
$line
=
$token
[
2
];
break
;
}
}
}
if
(
$file
)
{
break
;
}
}
}
if
(
is_object
(
$value
))
{
$value
=
get_class
(
$value
);
}
return
[
"name"
=>
$key
,
"value"
=>
$value
,
"file"
=>
$file
===
null
?
null
:
str_replace
(
base_path
(
DIRECTORY_SEPARATOR
),
''
,
$file
),
"line"
=>
$line
];
}
function
vsCodeUnpackDottedKey
(
$value
,
$key
)
{
$arr
=
[
$key
=>
$value
];
$parts
=
explode
(
'.'
,
$key
);
array_pop
(
$parts
);
while
(
count
(
$parts
))
{
$arr
[
implode
(
'.'
,
$parts
)]
=
'array(...)'
;
array_pop
(
$parts
);
}
return
$arr
;
}
echo
collect
(
\Illuminate\Support\Arr
::
dot
(
config
()
->
all
()))
->
mapWithKeys
(
fn
(
$value
,
$key
)
=>
vsCodeUnpackDottedKey
(
$value
,
$key
))
->
map
(
fn
(
$value
,
$key
)
=>
vsCodeGetConfigValue
(
$value
,
$key
,
$configPaths
))
->
filter
()
->
values
()
->
toJson
();
echo
LaravelVsCode
::
outputMarker
(
'END_OUTPUT'
);
exit
(
0
);
vendor/_laravel_ide/discover-e691d398bdcb7c046a57f3e4553bb28a.php
deleted
100644 → 0
View file @
81a5362d
<?php
error_reporting
(
E_ERROR
|
E_PARSE
);
define
(
'LARAVEL_START'
,
microtime
(
true
));
require_once
__DIR__
.
'/../autoload.php'
;
class
LaravelVsCode
{
public
static
function
relativePath
(
$path
)
{
if
(
!
str_contains
(
$path
,
base_path
()))
{
return
(
string
)
$path
;
}
return
ltrim
(
str_replace
(
base_path
(),
''
,
realpath
(
$path
)
?:
$path
),
DIRECTORY_SEPARATOR
);
}
public
static
function
isVendor
(
$path
)
{
return
str_contains
(
$path
,
base_path
(
"vendor"
));
}
public
static
function
outputMarker
(
$key
)
{
return
'__VSCODE_LARAVEL_'
.
$key
.
'__'
;
}
public
static
function
startupError
(
\Throwable
$e
)
{
throw
new
Error
(
self
::
outputMarker
(
'STARTUP_ERROR'
)
.
': '
.
$e
->
getMessage
());
}
}
try
{
$app
=
require_once
__DIR__
.
'/../../bootstrap/app.php'
;
}
catch
(
\Throwable
$e
)
{
LaravelVsCode
::
startupError
(
$e
);
exit
(
1
);
}
$app
->
register
(
new
class
($
app
)
extends
\Illuminate\Support\ServiceProvider
{
public
function
boot
()
{
config
([
'logging.channels.null'
=>
[
'driver'
=>
'monolog'
,
'handler'
=>
\Monolog\Handler\NullHandler
::
class
,
],
'logging.default'
=>
'null'
,
]);
}
});
try
{
$kernel
=
$app
->
make
(
Illuminate\Contracts\Console\Kernel
::
class
);
$kernel
->
bootstrap
();
}
catch
(
\Throwable
$e
)
{
LaravelVsCode
::
startupError
(
$e
);
exit
(
1
);
}
echo
LaravelVsCode
::
outputMarker
(
'START_OUTPUT'
);
$translator
=
new
class
{
public
$paths
=
[];
public
$values
=
[];
public
$paramResults
=
[];
public
$params
=
[];
public
$emptyParams
=
[];
public
$directoriesToWatch
=
[];
public
$languages
=
[];
public
function
all
()
{
$final
=
[];
foreach
(
$this
->
retrieve
()
as
$value
)
{
if
(
$value
instanceof
\Illuminate\Support\LazyCollection
)
{
foreach
(
$value
as
$val
)
{
$dotKey
=
$val
[
"k"
];
$final
[
$dotKey
]
??=
[];
if
(
!
in_array
(
$val
[
"la"
],
$this
->
languages
))
{
$this
->
languages
[]
=
$val
[
"la"
];
}
$final
[
$dotKey
][
$val
[
"la"
]]
=
$val
[
"vs"
];
}
}
else
{
foreach
(
$value
[
"vs"
]
as
$v
)
{
$dotKey
=
"
{
$value
[
"k"
]
}
.
{
$v
[
'k'
]
}
"
;
$final
[
$dotKey
]
??=
[];
if
(
!
in_array
(
$value
[
"la"
],
$this
->
languages
))
{
$this
->
languages
[]
=
$value
[
"la"
];
}
$final
[
$dotKey
][
$value
[
"la"
]]
=
$v
[
'arr'
];
}
}
}
return
$final
;
}
protected
function
retrieve
()
{
$loader
=
app
(
"translator"
)
->
getLoader
();
$namespaces
=
$loader
->
namespaces
();
$paths
=
$this
->
getPaths
(
$loader
);
$default
=
collect
(
$paths
)
->
flatMap
(
fn
(
$path
)
=>
$this
->
collectFromPath
(
$path
)
);
$namespaced
=
collect
(
$namespaces
)
->
flatMap
(
fn
(
$path
,
$namespace
)
=>
$this
->
collectFromPath
(
$path
,
$namespace
)
);
return
$default
->
merge
(
$namespaced
);
}
protected
function
getPaths
(
$loader
)
{
$reflection
=
new
ReflectionClass
(
$loader
);
$property
=
null
;
if
(
$reflection
->
hasProperty
(
"paths"
))
{
$property
=
$reflection
->
getProperty
(
"paths"
);
}
else
if
(
$reflection
->
hasProperty
(
"path"
))
{
$property
=
$reflection
->
getProperty
(
"path"
);
}
if
(
$property
!==
null
)
{
$property
->
setAccessible
(
true
);
return
\Illuminate\Support\Arr
::
wrap
(
$property
->
getValue
(
$loader
));
}
return
[];
}
public
function
collectFromPath
(
string
$path
,
?
string
$namespace
=
null
)
{
$realPath
=
realpath
(
$path
);
if
(
!
is_dir
(
$realPath
))
{
return
[];
}
if
(
!
LaravelVsCode
::
isVendor
(
$realPath
))
{
$this
->
directoriesToWatch
[]
=
LaravelVsCode
::
relativePath
(
$realPath
);
}
return
array_map
(
fn
(
$file
)
=>
$this
->
fromFile
(
$file
,
$path
,
$namespace
),
\Illuminate\Support\Facades\File
::
allFiles
(
$realPath
),
);
}
protected
function
fromFile
(
$file
,
$path
,
$namespace
)
{
if
(
pathinfo
(
$file
,
PATHINFO_EXTENSION
)
===
'json'
)
{
return
$this
->
fromJsonFile
(
$file
,
$path
,
$namespace
);
}
return
$this
->
fromPhpFile
(
$file
,
$path
,
$namespace
);
}
protected
function
linesFromJsonFile
(
$file
)
{
$contents
=
file_get_contents
(
$file
);
try
{
$json
=
json_decode
(
$contents
,
true
)
??
[];
}
catch
(
\Throwable
$e
)
{
return
[[],
[]];
}
if
(
count
(
$json
)
===
0
)
{
return
[[],
[]];
}
$lines
=
explode
(
PHP_EOL
,
$contents
);
$encoded
=
array_map
(
fn
(
$k
)
=>
[
json_encode
(
$k
,
JSON_UNESCAPED_UNICODE
|
JSON_UNESCAPED_SLASHES
),
$k
],
array_keys
(
$json
),
);
$result
=
[];
$searchRange
=
5
;
foreach
(
$encoded
as
$index
=>
$keys
)
{
// Pretty likely to be on the line that is the index, go happy path first
if
(
strpos
(
$lines
[
$index
+
1
]
??
''
,
$keys
[
0
])
!==
false
)
{
$result
[
$keys
[
1
]]
=
$index
+
2
;
continue
;
}
// Search around the index, likely to be within $searchRange lines
$start
=
max
(
0
,
$index
-
$searchRange
);
$end
=
min
(
$index
+
$searchRange
,
count
(
$lines
)
-
1
);
$current
=
$start
;
while
(
$current
<=
$end
)
{
if
(
strpos
(
$lines
[
$current
],
$keys
[
0
])
!==
false
)
{
$result
[
$keys
[
1
]]
=
$current
+
1
;
break
;
}
$current
++
;
}
}
return
[
$json
,
$result
];
}
protected
function
linesFromPhpFile
(
$file
)
{
$tokens
=
token_get_all
(
file_get_contents
(
$file
));
$found
=
[];
$inArrayKey
=
true
;
$arrayDepth
=
-
1
;
$depthKeys
=
[];
foreach
(
$tokens
as
$token
)
{
if
(
!
is_array
(
$token
))
{
if
(
$token
===
'['
)
{
$inArrayKey
=
true
;
$arrayDepth
++
;
}
if
(
$token
===
']'
)
{
$inArrayKey
=
true
;
$arrayDepth
--
;
array_pop
(
$depthKeys
);
}
continue
;
}
if
(
$token
[
0
]
===
T_DOUBLE_ARROW
)
{
$inArrayKey
=
false
;
}
if
(
$inArrayKey
&&
$token
[
0
]
===
T_CONSTANT_ENCAPSED_STRING
)
{
$depthKeys
[
$arrayDepth
]
=
trim
(
$token
[
1
],
'"\''
);
\Illuminate\Support\Arr
::
set
(
$found
,
implode
(
'.'
,
$depthKeys
),
$token
[
2
]);
}
if
(
!
$inArrayKey
&&
$token
[
0
]
===
T_CONSTANT_ENCAPSED_STRING
)
{
$inArrayKey
=
true
;
}
}
return
\Illuminate\Support\Arr
::
dot
(
$found
);
}
protected
function
getDotted
(
$key
,
$lang
)
{
try
{
return
\Illuminate\Support\Arr
::
dot
(
\Illuminate\Support\Arr
::
wrap
(
__
(
$key
,
[],
$lang
),
),
);
}
catch
(
\Throwable
$e
)
{
// Most likely, in this case, the lang file doesn't return an array
return
[];
}
}
protected
function
getPathIndex
(
$file
)
{
$path
=
LaravelVsCode
::
relativePath
(
$file
);
$index
=
$this
->
paths
[
$path
]
??
null
;
if
(
$index
!==
null
)
{
return
$index
;
}
$this
->
paths
[
$path
]
=
count
(
$this
->
paths
);
return
$this
->
paths
[
$path
];
}
protected
function
getValueIndex
(
$value
)
{
$index
=
$this
->
values
[
$value
]
??
null
;
if
(
$index
!==
null
)
{
return
$index
;
}
$this
->
values
[
$value
]
=
count
(
$this
->
values
);
return
$this
->
values
[
$value
];
}
protected
function
getParamIndex
(
$key
)
{
$processed
=
$this
->
params
[
$key
]
??
null
;
if
(
$processed
)
{
return
$processed
[
0
];
}
if
(
in_array
(
$key
,
$this
->
emptyParams
))
{
return
null
;
}
$params
=
preg_match_all
(
"/\:([A-Za-z0-9_]+)/"
,
$key
,
$matches
)
?
$matches
[
1
]
:
[];
if
(
count
(
$params
)
===
0
)
{
$this
->
emptyParams
[]
=
$key
;
return
null
;
}
$paramKey
=
json_encode
(
$params
);
$paramIndex
=
$this
->
paramResults
[
$paramKey
]
??
null
;
if
(
$paramIndex
!==
null
)
{
$this
->
params
[
$key
]
=
[
$paramIndex
,
$params
];
return
$paramIndex
;
}
$paramIndex
=
count
(
$this
->
paramResults
);
$this
->
paramResults
[
$paramKey
]
=
$paramIndex
;
$this
->
params
[
$key
]
=
[
$paramIndex
,
$params
];
return
$paramIndex
;
}
protected
function
fromJsonFile
(
$file
,
$path
,
$namespace
)
{
$lang
=
pathinfo
(
$file
,
PATHINFO_FILENAME
);
$relativePath
=
$this
->
getPathIndex
(
$file
);
$lines
=
\Illuminate\Support\Facades\File
::
lines
(
$file
);
return
\Illuminate\Support\LazyCollection
::
make
(
function
()
use
(
$file
,
$lang
,
$relativePath
,
$lines
)
{
[
$json
,
$lines
]
=
$this
->
linesFromJsonFile
(
$file
);
foreach
(
$json
as
$key
=>
$value
)
{
if
(
!
array_key_exists
(
$key
,
$lines
)
||
is_array
(
$value
))
{
continue
;
}
yield
[
"k"
=>
$key
,
"la"
=>
$lang
,
"vs"
=>
[
$this
->
getValueIndex
(
$value
),
$relativePath
,
$lines
[
$key
]
??
null
,
$this
->
getParamIndex
(
$key
),
],
];
}
});
}
protected
function
fromPhpFile
(
$file
,
$path
,
$namespace
)
{
$key
=
pathinfo
(
$file
,
PATHINFO_FILENAME
);
if
(
$namespace
)
{
$key
=
"
{
$namespace
}
::
{
$key
}
"
;
}
$lang
=
collect
(
explode
(
DIRECTORY_SEPARATOR
,
str_replace
(
$path
,
""
,
$file
)))
->
filter
()
->
slice
(
-
2
,
1
)
->
first
();
$relativePath
=
$this
->
getPathIndex
(
$file
);
$lines
=
$this
->
linesFromPhpFile
(
$file
);
return
[
"k"
=>
$key
,
"la"
=>
$lang
,
"vs"
=>
\Illuminate\Support\LazyCollection
::
make
(
function
()
use
(
$key
,
$lang
,
$relativePath
,
$lines
)
{
foreach
(
$this
->
getDotted
(
$key
,
[],
$lang
)
as
$key
=>
$value
)
{
if
(
!
array_key_exists
(
$key
,
$lines
)
||
is_array
(
$value
))
{
continue
;
}
yield
[
'k'
=>
$key
,
'arr'
=>
[
$this
->
getValueIndex
(
$value
),
$relativePath
,
$lines
[
$key
],
$this
->
getParamIndex
(
$value
),
],
];
}
}),
];
}
};
echo
json_encode
([
'default'
=>
\Illuminate\Support\Facades\App
::
currentLocale
(),
'translations'
=>
$translator
->
all
(),
'languages'
=>
$translator
->
languages
,
'paths'
=>
array_keys
(
$translator
->
paths
),
'values'
=>
array_keys
(
$translator
->
values
),
'params'
=>
array_map
(
fn
(
$p
)
=>
json_decode
(
$p
,
true
),
array_keys
(
$translator
->
paramResults
)),
'to_watch'
=>
$translator
->
directoriesToWatch
,
],
JSON_UNESCAPED_UNICODE
|
JSON_UNESCAPED_SLASHES
);
echo
LaravelVsCode
::
outputMarker
(
'END_OUTPUT'
);
exit
(
0
);
vendor/_laravel_ide/discover-ea280fb1636eb761c4fd23f76666e397.php
deleted
100644 → 0
View file @
81a5362d
<?php
error_reporting
(
E_ERROR
|
E_PARSE
);
define
(
'LARAVEL_START'
,
microtime
(
true
));
require_once
__DIR__
.
'/../autoload.php'
;
class
LaravelVsCode
{
public
static
function
relativePath
(
$path
)
{
if
(
!
str_contains
(
$path
,
base_path
()))
{
return
(
string
)
$path
;
}
return
ltrim
(
str_replace
(
base_path
(),
''
,
realpath
(
$path
)
?:
$path
),
DIRECTORY_SEPARATOR
);
}
public
static
function
isVendor
(
$path
)
{
return
str_contains
(
$path
,
base_path
(
"vendor"
));
}
public
static
function
outputMarker
(
$key
)
{
return
'__VSCODE_LARAVEL_'
.
$key
.
'__'
;
}
public
static
function
startupError
(
\Throwable
$e
)
{
throw
new
Error
(
self
::
outputMarker
(
'STARTUP_ERROR'
)
.
': '
.
$e
->
getMessage
());
}
}
try
{
$app
=
require_once
__DIR__
.
'/../../bootstrap/app.php'
;
}
catch
(
\Throwable
$e
)
{
LaravelVsCode
::
startupError
(
$e
);
exit
(
1
);
}
$app
->
register
(
new
class
($
app
)
extends
\Illuminate\Support\ServiceProvider
{
public
function
boot
()
{
config
([
'logging.channels.null'
=>
[
'driver'
=>
'monolog'
,
'handler'
=>
\Monolog\Handler\NullHandler
::
class
,
],
'logging.default'
=>
'null'
,
]);
}
});
try
{
$kernel
=
$app
->
make
(
Illuminate\Contracts\Console\Kernel
::
class
);
$kernel
->
bootstrap
();
}
catch
(
\Throwable
$e
)
{
LaravelVsCode
::
startupError
(
$e
);
exit
(
1
);
}
echo
LaravelVsCode
::
outputMarker
(
'START_OUTPUT'
);
collect
(
glob
(
base_path
(
'**/Models/*.php'
)))
->
each
(
fn
(
$file
)
=>
include_once
(
$file
));
$modelPolicies
=
collect
(
get_declared_classes
())
->
filter
(
fn
(
$class
)
=>
is_subclass_of
(
$class
,
\Illuminate\Database\Eloquent\Model
::
class
))
->
filter
(
fn
(
$class
)
=>
!
in_array
(
$class
,
[
\Illuminate\Database\Eloquent\Relations\Pivot
::
class
,
\Illuminate\Foundation\Auth\User
::
class
,
]))
->
flatMap
(
fn
(
$class
)
=>
[
$class
=>
\Illuminate\Support\Facades\Gate
::
getPolicyFor
(
$class
),
])
->
filter
(
fn
(
$policy
)
=>
$policy
!==
null
);
function
vsCodeGetAuthenticatable
()
{
try
{
$guard
=
auth
()
->
guard
();
$reflection
=
new
\ReflectionClass
(
$guard
);
if
(
!
$reflection
->
hasProperty
(
"provider"
))
{
return
null
;
}
$property
=
$reflection
->
getProperty
(
"provider"
);
$provider
=
$property
->
getValue
(
$guard
);
if
(
$provider
instanceof
\Illuminate\Auth\EloquentUserProvider
)
{
$providerReflection
=
new
\ReflectionClass
(
$provider
);
$modelProperty
=
$providerReflection
->
getProperty
(
"model"
);
return
str
(
$modelProperty
->
getValue
(
$provider
))
->
prepend
(
"
\\
"
)
->
toString
();
}
if
(
$provider
instanceof
\Illuminate\Auth\DatabaseUserProvider
)
{
return
str
(
\Illuminate\Auth\GenericUser
::
class
)
->
prepend
(
"
\\
"
)
->
toString
();
}
}
catch
(
\Exception
|
\Throwable
$e
)
{
return
null
;
}
return
null
;
}
function
vsCodeGetPolicyInfo
(
$policy
,
$model
)
{
$methods
=
(
new
ReflectionClass
(
$policy
))
->
getMethods
();
return
collect
(
$methods
)
->
map
(
fn
(
ReflectionMethod
$method
)
=>
[
'key'
=>
$method
->
getName
(),
'uri'
=>
$method
->
getFileName
(),
'policy'
=>
is_string
(
$policy
)
?
$policy
:
get_class
(
$policy
),
'model'
=>
$model
,
'line'
=>
$method
->
getStartLine
(),
])
->
filter
(
fn
(
$ability
)
=>
!
in_array
(
$ability
[
'key'
],
[
'allow'
,
'deny'
]));
}
echo
json_encode
([
'authenticatable'
=>
vsCodeGetAuthenticatable
(),
'policies'
=>
collect
(
\Illuminate\Support\Facades\Gate
::
abilities
())
->
map
(
function
(
$policy
,
$key
)
{
$reflection
=
new
\ReflectionFunction
(
$policy
);
$policyClass
=
null
;
$closureThis
=
$reflection
->
getClosureThis
();
if
(
$closureThis
!==
null
)
{
if
(
get_class
(
$closureThis
)
===
\Illuminate\Auth\Access\Gate
::
class
)
{
$vars
=
$reflection
->
getClosureUsedVariables
();
if
(
isset
(
$vars
[
'callback'
]))
{
[
$policyClass
,
$method
]
=
explode
(
'@'
,
$vars
[
'callback'
]);
$reflection
=
new
\ReflectionMethod
(
$policyClass
,
$method
);
}
}
}
return
[
'key'
=>
$key
,
'uri'
=>
$reflection
->
getFileName
(),
'policy'
=>
$policyClass
,
'line'
=>
$reflection
->
getStartLine
(),
];
})
->
merge
(
collect
(
\Illuminate\Support\Facades\Gate
::
policies
())
->
flatMap
(
fn
(
$policy
,
$model
)
=>
vsCodeGetPolicyInfo
(
$policy
,
$model
)),
)
->
merge
(
$modelPolicies
->
flatMap
(
fn
(
$policy
,
$model
)
=>
vsCodeGetPolicyInfo
(
$policy
,
$model
)),
)
->
values
()
->
groupBy
(
'key'
)
->
map
(
fn
(
$item
)
=>
$item
->
map
(
fn
(
$i
)
=>
\Illuminate\Support\Arr
::
except
(
$i
,
'key'
))),
]);
echo
LaravelVsCode
::
outputMarker
(
'END_OUTPUT'
);
exit
(
0
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment