自 2020 年 8 月以来我遇到了问题,但我仍然不知道如何重现,我正在使用dfahlander/Dexie.js来使用浏览器 indexedDB。
这是我如何使用 dexie 的示例:-
import db from "./db";
import { useState, useEffect } from "react";
import axios from "axios";
import { useParams } from "react-router-dom";
export default function App() {
const params = useParams();
const [storedRead, setStoredRead] = useState();
const [data,setData] = useState();
useEffect(() => {
db.reads
.get({ hash: params.id })
.then((data) => {
setStoredRead(data);
readRequest(data ? data.token : "");
})
.catch((e) => {
//Here i am getting error with ios users, not …Run Code Online (Sandbox Code Playgroud) 我已将confing/app.php中的默认网站本地化更改为(de)
'locale' => 'de',
'fallback_locale' => 'de',
Run Code Online (Sandbox Code Playgroud)
但仍有网站加载'en'本地化.
我尝试清除视图缓存和缓存,但没有任何改变.
我正在使用 https://github.com/mcamara/laravel-localization
只有在我使用URL domainname.com/de时才会激活de
我正在构建一个网络应用程序(图书读者组),每个人都可以从网站图书中选择一本书,然后为该书创建一个读者组。
1-用户选择了一本名为(如何使用 ReactJS 进行开发)的书。
2-用户指定小组人数,假设有 20 人阅读该书。那么,选定的书页将被分为 /20 人。
3- 用户将有一个发送给其读者组的阅读 URL。
我稍后可能会添加一个功能,读者可以向群组创建者发送内部消息......
现在我很困惑应该选择哪个数据库,对我来说实施的难易程度并不重要。
我的问题是成本,因为我预计网站的流量很高。如果 SQL 和 noSQL 之间的读取速度差异小于 1 秒,那么速度对我来说并不是真正必要的,重要的是服务 24 小时的可访问性和可用性,当然还有成本。假设如果选择 Amazon Dynamo DB ,dynamo db 将根据每个读写请求收取费用。
db.m5.xlarge 实例的 Amazon RDS (Mysql) 每小时费率为每 GB 每月 0.396 美元和 0.133 美元,稍后我可能需要运行自动扩展来启动更多实例。
而在 DynamoDB 中,则根据读写请求和存储使用情况进行收费。
database-design amazon-web-services amazon-rds amazon-dynamodb
我正在尝试使用Laravel 请求验证方法制作登录页面
凭证验证 -> 如果用户未经过身份验证,它将返回“密码错误......”的错误
我在两种不同情况下看到错误:-
1- 当点击登录按钮而不填写任何内容时:-
htmlspecialchars() expects parameter 1 to be string, object given (View: C:\xampp\htdocs\nfbweb\resources\views\login.blade.php)
Run Code Online (Sandbox Code Playgroud)
2-当填写随机/错误的用户名和密码时:
ErrorException in f65ed669c524327dfe53b3286e027354370e4cf5.php line 13:
Call to a member function all() on string (View: C:\xampp\htdocs\nfbweb\resources\views\login.blade.php)
Run Code Online (Sandbox Code Playgroud)
这是我的登录视图文件:-
<h1>Login Page</h1>
@if (session()->has('errors'))
<div class="alert alert-danger">
<ul>
{{session('errors')}}
</ul>
</div>
@endif
@if (count($errors) > 0)
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<form action="{{route('dologin')}}" method="post">
{{csrf_field()}}
Username: <input type="text" name="username" autocomplete="off">
<br>
<br>
Password: …Run Code Online (Sandbox Code Playgroud) 我正在使用react-bootstrap选项卡组件:
如何在选项卡标题(消息)旁边添加徽章
<span class="badge badge-success">20</span>
<Tabs
id="controlled-tab-example"
activeKey={key}
onSelect={(k) => setKey(k)}
>
<Tab eventKey="home" title="Home">
<Home/>
</Tab>
<Tab eventKey="profile" title="Profile">
<Profile/>
</Tab>
<Tab eventKey="contact" title="Messages" disabled>
<Messages/>
</Tab>
</Tabs>
Run Code Online (Sandbox Code Playgroud)
所以我可以向用户显示他有多少条未读消息。
我在我的reactjs应用程序上使用tawk.io聊天:-这是我的index.js文件的内容:-
import React from "react";
import ReactDOM from "react-dom";
import App from "./App";
import { BrowserRouter, Switch, Route } from "react-router-dom";
import BookRead from "./pages/BookRead";
ReactDOM.render(
<React.StrictMode>
<BrowserRouter>
<Switch>
<Route exact path="/view/:id/:section/:part" component={BookRead} />
<Route component={App} />
</Switch>
</BrowserRouter>
</React.StrictMode>,
document.getElementById("root")
);
Run Code Online (Sandbox Code Playgroud)
App.js 组件文件内容:-
import React, { useEffect, useState } from "react";
import { Route } from "react-router-dom";
import Login from "./pages/Login";
import Account from "./pages/Account";
import Contact from "./pages/Contact";
import Home from "./pages/Home";
function App(props) {
useEffect(() => { …Run Code Online (Sandbox Code Playgroud) 我之前手动删除了 App* 中的一些模型文件,并通过删除“s”符号创建了其他文件,因为默认情况下 Laravel 可以识别来自 name 的模型,而 Laravel 标准的模型必须正常书写而不是复数形式。
在删除我使用 php artisan make:model Buildings -m 创建的模型之前
我删除(建筑物)模型后创建的新模型是 php artisan make:model Building 请注意,我刚刚创建了一个没有 's' 的新模型
现在在我的用户模型中,我创建了方法:
public function UserAssignedBuilding(){
return $this->hasManyThrough('App\Building','App\Area','user_id','area_id');
}
Run Code Online (Sandbox Code Playgroud)
Building.php 模型文件
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Building extends Model
{
protected $table = 'buildings';
public function areas(){
$this->belongsTo('App\Area');
}
}
Run Code Online (Sandbox Code Playgroud)
Area.php 模型文件:
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Area extends Model
{
protected $fillable = [
'name'
];
public function users(){
return $this->belongsToMany('App\User','area_user','area_id','user_id');
}
public function buildings(){ …Run Code Online (Sandbox Code Playgroud) 我的控制器上有以下 Guzzle 发送请求:-
$client = new GuzzleHttp\Client(['base_uri' => 'https://domainname/api/v1/']);
$response = $client->request('POST', 'user/register', [
'headers' => [
'Authorization' => Session::get('token'),
'Content-Type' => 'application/x-www-form-urlencoded'
]],
[ 'form_params' => [
'user_id' => $user->id,
'start_date' => $start_date,
'expiry_date' => $expiry_date
],
]);
$response= $response->getBody();
Run Code Online (Sandbox Code Playgroud)
上面的语法仅发送标头,但是,我应该使用什么正确的语法来发送标头和正文。
App\User 模型文件的内容:-
<?php
namespace App;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Tymon\JWTAuth\Contracts\JWTSubject;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable implements JWTSubject
{
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password',
];
public function khatmas()
{
return $this->hasMany('App\Khatma');
}
public function messages()
{
return $this->hasManyThrough('App\KhatmaRead','App\Khatma')
->select('reader_name','message','updated_at')
->where('message','!=',NULL);
}
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [ …Run Code Online (Sandbox Code Playgroud) 我在数据库中有 3 个表(用户、区域、区域用户),
用户表:id 名称 用户名 密码
区域表:id 名称
area_user 表:id user_id area_id
我正在尝试创建一个(列表用户页面),它将显示用户分配区域的所有用户表列。
User.php 模型文件
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable{
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['name', 'email', 'password','role_id',];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = ['password', 'remember_token',];
public function areas(){
return $this->belongsToMany('App\Area','area_user');
}
Run Code Online (Sandbox Code Playgroud)
Area.php 模型文件:
<?php
namespace …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 Laravel 默认邮件外观发送电子邮件:-
Mail::to($user->email)->send(New NotifyUserExpiring($diff,$Sub->user));
Run Code Online (Sandbox Code Playgroud)
在 Mail\NotifyUserExpiring 中:-
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
class NotifyUserExpiring extends Mailable
{
use Queueable, SerializesModels;
/**
* Create a new message instance.
*
* @return void
*/
protected $user;
protected $diff;
public function __construct($diff,$user)
{
$this->user = $user;
$this->diff = $diff;
}
/**
* Build the message.
*
* @return $this
*/
public function build()
{
return $this->view('web.mail.NotifyUserExpiring')->with('user',$this->user)->with('diff',$this->diff);
}
}
Run Code Online (Sandbox Code Playgroud)
在 web.mail.NotifyUserExpiring View 文件中,我使用刀片式打印变量方式:-
Hello {{ $user->first_name }} …Run Code Online (Sandbox Code Playgroud) laravel ×7
php ×5
eloquent ×3
reactjs ×3
javascript ×2
amazon-rds ×1
dexie ×1
dexiejs ×1
guzzle ×1
http ×1
http-post ×1
indexeddb ×1
laravel-5.3 ×1
laravel-5.8 ×1
localization ×1
mysql ×1
tawk.to ×1
validation ×1