我正在使用DatePickerInputreact 组件并想在<input />里面设置元素的样式。使用组件的className属性,我只能<div />围绕容器设置样式。使用classNames对象属性还可以设置其他容器的样式。
那么是否有可能,如果有,如何将 CSS 类直接应用于<input />元素(我正在使用 Bootstrap,所以我想添加类“form-control”以保持一致性)?
如果我这样做:
$obj = factory(Object::class)->make();
collect($obj);
Run Code Online (Sandbox Code Playgroud)
我返回了一个类型的集合:
Illuminate\Support\Collection
Run Code Online (Sandbox Code Playgroud)
Laravel 还允许您使用特定方法定义自己的集合。在模型中,您执行以下操作:
public function newCollection(array $models = [])
{
return new CustomCollection($models);
}
Run Code Online (Sandbox Code Playgroud)
你会CustomCollection在文件 CustomCollection.php 中创建你的,像这样开始:
class CustomCollection extends Collection
{
Run Code Online (Sandbox Code Playgroud)
我想知道如何返回类型的集合:
Illuminate\Database\Eloquent\Collection
Run Code Online (Sandbox Code Playgroud)
或者,在创建我自己的自定义集合的情况下,我怎么能返回一个类型的集合:
App\Models\CustomCollection
Run Code Online (Sandbox Code Playgroud)
我想用 collect()帮助程序或任何其他方式因为我不会出于编写 PHPUnit 测试的目的访问数据库。
==========
编辑:我factory(Object::class)->make()用来欺骗我试图放入集合的 Eloquent 对象。
如果您只是这样做factory(Object::class, 1)->make(),工厂会Object::class为您将 的单个实例滚动到 Eloquent 集合中。
当我单击工具栏图标时,我试图使用有角度的材料打开侧面导航。一切正常,直到我尝试实际打开导航栏,我收到错误:
由 /src/app/app.module.ts 中的 AppModule 模块导入的意外指令 'MatDrawer in @angular/material/sidenav/index.d.ts'。请添加@NgModule 注释。
这是 npm 模块 (package.json):
"@angular/animations": "^9.1.11",
"@angular/cdk": "^9.2.4",
"@angular/common": "~9.1.11",
"@angular/compiler": "~9.1.11",
"@angular/core": "~9.1.11",
"@angular/forms": "~9.1.11",
"@angular/material": "^9.2.4",
"@angular/platform-browser": "~9.1.11",
"@angular/platform-browser-dynamic": "~9.1.11",
"@angular/router": "~9.1.11",
"jQuery": "^1.7.4",
"jquery": "^3.5.1",
"rxjs": "~6.5.4",
"tslib": "^1.10.0",
"zone.js": "~0.10.2"
Run Code Online (Sandbox Code Playgroud)
这是我的 app.module:
import { MatDrawer } from '@angular/material/sidenav';
import { MatDrawerContainer } from '@angular/material/sidenav';
@NgModule({
declarations: [
AppComponent,
DressesComponent,
LoadingSpinnerComponent,
Toolbar,
ButtonToggle,
Sidenav
],
imports: [
BrowserModule,
AppRoutingModule,
HttpClientModule,
BrowserAnimationsModule,
MatTableModule,
MatSelectModule,
MatDialogModule,
MatInputModule,
MatToolbarModule,
MatIconModule, …Run Code Online (Sandbox Code Playgroud) 我无法找到哪里出了问题。当我运行该程序时,它显示“访问被拒绝”。
#include<stdio.h>
int main()
{
char arr[4][40] =
{ "array of c string",
"is fun to use",
"make sure to properly",
"tell the array size"
};
char *p = arr; /*Char-4-eg-Find-the-output.c:10:11: warning: initialization of 'char *' from
incompatible pointer type 'char (*)[40]' [-Wincompatible-pointer-types]*/
for (int i = 0; i < 100; i++)
{
printf("%c",*p );
p++;
}
return 0;
}
Run Code Online (Sandbox Code Playgroud) 我尝试在通过 URL 传递参数时删除特殊字符,以避免被入侵者注入,例如我有以下 URL:
www.sitename.com/people?job=manager
Run Code Online (Sandbox Code Playgroud)
我alert在参数后面添加了一个脚本,如下所示:
www.sitename.com/people?job=manager"/><script>alert%2844749%29<%2fscript>
Run Code Online (Sandbox Code Playgroud)
当我运行该 URL 时,将alert弹出,这可能会导致通过此技术检索站点信息时出现漏洞。我将使用$_REQUEST获取传递参数来生成结果。我可以在下面应用这种方法来逃避 URL 注入技术吗?
$job = $_REQUEST["job"];
Run Code Online (Sandbox Code Playgroud)
谢谢你的建议。
所以我从我的数据库中获取数据以打印在表格中,但是它说
找不到类“App\Http\Controllers\User”。
这是控制器,这是我将如何打印数据
public function directory()
{
$dashboardTitle = "Directory";
$isCurrent = "Directory";
$users = User::all();
return view('dashboard.directory', [
'dashboardTitle' => $dashboardTitle,
'isCurrent' => $isCurrent,
'users' => $users
]);
}
Run Code Online (Sandbox Code Playgroud)
要打印的表
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<thead>
<tr>
<th> Picture </th>
<th>Name</th>
<th>Email</th>
<th>User type</th>
<th>Birthdate</th>
<th>Contact number</th>
<th>Created time</th>
</tr>
@foreach($users as $user)
<tr>
<td>{{ $user->profile_image }}</td>
<td>{{ $user->name }}</td>
<td>{{ $user->email }}</td>
<td>{{ $user->user_type }}</td>
<td>{{ $user->bdate }}</td>
<td>{{ $user->contact_no}}</td>
<td>{{ $user->created_at }}</td>
</tr>
@endforeach
</thead>
<tfoot> …Run Code Online (Sandbox Code Playgroud) 我遇到过一个问题,试图淡化 div 背景图像的边缘,使其看起来与整个站点的背景图像混合(因此背景图像应用于正文)。
body{
background-image: url('some url here') !important;
background-repeat: no-repeat;
background-attachment: fixed;
background-position: 100%;
background-size: 1150px;
}
#blendElement{
background: url('some other url here');
background-attachment: fixed;
background-repeat: no-repeat;
background-size: 100%;
}Run Code Online (Sandbox Code Playgroud)
<head>
</head>
<body>
<div>
<div id="blendElement"> This should have edges blending to the main (body's) background image behind it.
</div>
</div>
</body>Run Code Online (Sandbox Code Playgroud)
如果您曾经使用过 PowerPoint 并尝试过一种称为软边缘的图像效果,那么这正是我在这里尝试做的。我能找到的唯一相关的“答案”是通过使用带插图的框阴影来获取实体背景颜色:
box-shadow: 25px 25px 50px 0 (color matching background color) inset;
Run Code Online (Sandbox Code Playgroud)
但由于主体有背景图像而不是纯色,因此无法使其看起来像是在混合。显然,在框阴影中使用透明颜色只会显示 div 背景图像,就像它通常看起来的那样。
有人可以帮我解决这个问题吗?(而且我无法编辑 div 图像以赋予其透明的淡入淡出边缘,因此必须直接使用 CSS 或 JS 完成)