我需要在URL的中间放置一个ID号来获取:
http://myapp.com/something/29/edit
Run Code Online (Sandbox Code Playgroud)
现在,我有这个:
'user_link' => ['here.i.need.to.put.my.route.with.the.number]
Run Code Online (Sandbox Code Playgroud)
我的号码来自$event->data->id,有没有办法在路线中间"连接"一个数字?就像是
'user_link' => ['something.{id}.edit]
'user_link' => ['something.'.$event->data->id .'.edit] <-- I I do that Laravel shows an error: Route [something.{107}.edit] not defined
Run Code Online (Sandbox Code Playgroud)
有问题的路线是:
Route::get('something/{id}/edit/', 'MyController@edit')->name('something.edit');
Run Code Online (Sandbox Code Playgroud)
可以name在路线中添加{id} 吗?
我有这个 sql (MariaDB) 查询,它工作正常:
SELECT
admin_combustibles.nombre,
admin_combustibles.id_combustible,
admin_combustible_unidades.nombre AS unidades,
admin_tipo_combustibles.nombre AS tipo_combustible,
admin_indice_combustibles.valor_combustible
FROM
admin_combustibles
INNER JOIN admin_combustible_unidades ON admin_combustibles.combustible_unidades_id = admin_combustible_unidades.id_combustible_unidad
INNER JOIN admin_tipo_combustibles ON admin_combustibles.tipo_combustible_id = admin_tipo_combustibles.id_tipo_combustible
LEFT JOIN admin_indice_combustibles ON admin_combustibles.id_combustible = admin_indice_combustibles.combustible_id
AND admin_indice_combustibles.anio = 1992
AND admin_indice_combustibles.mes = 6
ORDER BY
admin_combustibles.nombre
Run Code Online (Sandbox Code Playgroud)
但是当我尝试通过 Laravel 进行访问时,我遇到了一些错误,因为 Laravel在数字 1992 上放了一些,这样查询就不起作用了。
另外,我不知道如何AND在 Laravel 上做,我只有orOn但它不起作用:
$datos = AdminCombustible::select([
'admin_combustibles.nombre',
'admin_combustibles.id_combustible',
'admin_combustible_unidades.nombre AS unidades',
'admin_tipo_combustibles.nombre AS tipo_combustible',
'admin_indice_combustibles.valor_combustible'])
->join('admin_combustible_unidades', 'admin_combustibles.combustible_unidades_id', '=', 'admin_combustible_unidades.id_combustible_unidad')
->join('admin_tipo_combustibles', 'admin_combustibles.tipo_combustible_id', …Run Code Online (Sandbox Code Playgroud) 我有一个具有这种静态结构的对象:
let obj = {
"id": "",
"id_configuration": "",
"comment": "",
"mw_assigned": "",
};
Run Code Online (Sandbox Code Playgroud)
我想通过密钥更新它的属性。例如,如果我收到
const key = 'mw_assigned'
const value = '23'
Run Code Online (Sandbox Code Playgroud)
然后我想更新对象并拥有:
let obj = {
"id": "",
"id_configuration": "",
"comment": "",
"mw_assigned": "23",
};
Run Code Online (Sandbox Code Playgroud)
我该怎么办?我试图创建一个新对象,如下所示:
const new_obj = { ...obj, key: value }
Run Code Online (Sandbox Code Playgroud)
我不知道如何从变量中设置键和值的名称
我有这个代码:
\nconst expressionAttributeValues = {};\nexpressionAttributeValues[`:${status}`] = status; // TSLinst error\n// status is a string\nRun Code Online (Sandbox Code Playgroud)\n我收到了 TSlint 错误:
\n TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'. \xc2\xa0\xc2\xa0No index signature with a parameter of type 'string' was found on type '{}'.\nRun Code Online (Sandbox Code Playgroud)\n这行有什么问题吗?
\n我Limit对 DynamoDB 上的查询/扫描有疑问。
我的表有 1000 条记录,对所有记录的查询都返回 50 个值,但是如果我输入Limit5 个值,这并不意味着查询将返回前 5 个值,它只是说对 5 个项目的查询表(以任何顺序,所以它们可能是非常旧的项目或新项目),所以我有可能在查询中得到 0 个项目。如何实际获取查询的最新 5 项?我需要将 a 设置Limit为 5(数字是示例),因为查询/扫描比这更多的项目会很昂贵。
查询有这个输入
{
TableName: 'transactionsTable',
IndexName: 'transactionsByUserId',
ProjectionExpression: 'origin, receiver, #valid_status, createdAt, totalAmount',
KeyConditionExpression: 'userId = :userId',
ExpressionAttributeValues: {
':userId': 'user-id',
':payment_gateway': 'payment_gateway'
},
ExpressionAttributeNames: {
'#valid_status': 'status'
},
FilterExpression: '#valid_status = :payment_gateway',
Limit: 5
}
Run Code Online (Sandbox Code Playgroud)
我的表的索引是这样的:
我应该使用第二个索引或其他东西,用字段对它们进行排序,createdAt但是,我如何确定查询会查看所有项目?
我不知道如何修复此警告.这是发送警告的组件:
警告:ReporteBoxMapRaster正在更改要控制的hidden类型的非受控输入.输入元素不应从不受控制切换到受控制(或反之亦然).决定在组件的使用寿命期间使用受控或不受控制的输入元素.更多信息:htt fb sitereact-controlled-components
var ReporteBoxMapRaster = React.createClass({
print: function(){
$(ReactDOM.findDOMNode(this.refs.print_form)).submit();
},
render: function() {
if( this.props.extent ){
var legend = null;
switch( this.props.legend ){
case 'solid':
legend = <ReporteLegendSolid values={ this.props.values } />;
break;
case 'gradient':
legend = <ReporteLegendGradient values={ this.props.values } />;
break;
}
if( this.props.extra )
var extra = this.props.extra;
else
var extra = '';
var extent = this.props.extent;
var url = 'http://XXX.XXX.XXX/cgi-bin/mapserv?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&FORMAT=image/png&TRANSPARENT=true&';
url += 'LAYERS='+ this.props.layer +'&';
url += 'map=/opt/mapfile/reporte/'+ this.props.mapfile +'.map&';
url += 'TILED=false&WIDTH=780&HEIGHT=440&STYLES=&';
url …Run Code Online (Sandbox Code Playgroud) 随着$('h1').text(),我可以存在于体内的H1的所有文本(只有一个h1元素).但就我而言,文本中有很多空格,如:
<h1> hello text </h1>
Run Code Online (Sandbox Code Playgroud)
我怎么能只检索文本的开头和结尾的文本而不是空白?我只想要"你好文字".
用于检测:
我有 2 个集合,$all拥有所有值 (5),但$some只有 2 个值。我正在尝试这样做:对于 $all 的每个值,如果循环中的该项目位于 $some 集合中,则将该 $some 项目的值(类似的东西)放入输入中:
@foreach($all as $item)
<div>
@if(in_array($item->id, $some))
<input type="number" value="{{ Here I need to put the value of $some where id of some be teh same of $all }}">
@else
<input type="number" value="0">
@endif
</div>
@endforeach
Run Code Online (Sandbox Code Playgroud)
我不知道如何阅读和决定刀片内的所有内容。
编辑:我正在尝试这样的事情:
@if(in_array($item->id, $some))
<input type="number" value="{{ $some->find($item->id)->value }}">
Run Code Online (Sandbox Code Playgroud) 有没有办法在字段上扫描特定类型?
例如,我有一个名为“code”的字段,我想扫描“code”为数字的项目。在我的数据库中,“代码”始终是“字符串”,但我需要获取一个存储为数字的项目
laravel ×3
blade ×1
javascript ×1
jquery ×1
mysql ×1
php ×1
reactjs ×1
routes ×1
tslint ×1
typescript ×1