我的目标是删除 github 上所有提交中的一个文件,因此我执行了后续步骤:
我用这个命令过滤了我的分支:
git filter-branch --index-filter 'git rm --cached --ignore-unmatch [file_name]' HEAD
Run Code Online (Sandbox Code Playgroud)
在所有提交中删除一个文件,现在在运行后删除一个文件
git status
Run Code Online (Sandbox Code Playgroud)
它要求我拉,
ubuntu@ubuntu:/var/www/html/laravel/app_folder$ git status
On branch master
Your branch and 'origin/master' have diverged,
and have 18 and 18 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
nothing to commit, working directory clean
Run Code Online (Sandbox Code Playgroud)
但我不想拉。我担心如果我拉出,我的提交中会再次出现这个文件。
难道我现在不应该推送它以便更改在我的 git hub 上生效吗……我不知道该怎么做。
当我们做这样的事情时:
Storage::disk('local')->put('file.txt', 'Contents');
Run Code Online (Sandbox Code Playgroud)
如何在视图中创建指向该文件的链接?像这样的东西:
<a href="path_to_file.txt">Download File</a>
Run Code Online (Sandbox Code Playgroud)
文档中有很多东西,但甚至没有一个示例如何创建指向该文件的链接
我的数据库中有一个软输入的输入,如果用户尝试创建一个具有相同名称的新输入,他将收到验证错误"name already exists"
解决这个问题的最佳做法是什么?
是不是更好的离开它,因为可能会恢复软删除的条目,这将导致冲突(如果我会以某种方式使其工作,以便用户可以插入具有相同名称的新条目)
我不知道做什么是正确的,但我确信我不是唯一有这种情况的人.
如果在运行php artisan命令时出现错误,日志文件将像这样创建:
-rw-rw-r-- 1 user www-data 2,2K Jul 28 18:08 laravel-2019-07-28.log
Run Code Online (Sandbox Code Playgroud)
如果通过网络浏览器使用应用程序时出现错误,日志文件将如下创建:
-rw-r--r-- 1 www-data www-data 2,2K Jul 28 16:10 laravel-2019-07-28.log
Run Code Online (Sandbox Code Playgroud)
www-data创建原始文件后,如果php artisancommand有错误,会报错,Permission denied因为无法写入日志
有没有办法为新创建的文件设置默认 chmod,以便它们始终rw用于组或者你们有其他一些解决方案
要重现此问题:
php artisan make:xy-> 这将产生错误并创建一个 .log 文件如何通过在Laravel 5.2的服务器端进行验证来验证用户是否至少选中了一个复选框
我有一个简单的选择框:
<label for="has_driverslicense">KFZ Führerschein: </label>
<select class="form-control" required="required" id="has_driverslicense" name="has_driverslicense">
<option value="0">Nein</option>
<option value="1">Ja</option>
</select>
Run Code Online (Sandbox Code Playgroud)
和一个隐藏的div:
<div id="kfz" style="display: none;">
<div>
<input id="checkbox-20" class="checkbox-style" name="B" type="checkbox">
<label for="checkbox-20" class="checkbox-style-3-label">B (Auto bis 3,49t)</label>
</div>
<div>
<input id="checkbox-21" class="checkbox-style" name="B+E" type="checkbox">
<label for="checkbox-21" class="checkbox-style-3-label">BE (Auto mit Anhänger)</label>
</div>
<div>
<input id="checkbox-22" class="checkbox-style" name="C1" type="checkbox">
<label for="checkbox-22" class="checkbox-style-3-label">C1 (LKW bis 7,49t)</label>
</div>
<div>
<input id="checkbox-23" class="checkbox-style" name="C" type="checkbox">
<label for="checkbox-23" class="checkbox-style-3-label">C (LKW bis 40t)</label>
</div>
<div>
<input id="checkbox-24" class="checkbox-style" name="CE" type="checkbox"> …Run Code Online (Sandbox Code Playgroud) 如何将税和brutto值舍入到2位小数...
我试过使用.toFixed(2)但是返回一个字符串,然后我再也无法用它计算了.
如果有人可以更新小提琴并让它工作吗?
并尝试输入23号
// calculate brutto and tax
$(document).on('keyup paste', '#netto', function () {
var netto = $("#netto").val();
$("#brutto").val(netto * 1.19).toFixed(2);
var brutto = $("#brutto").val();
$("#tax").val(brutto - netto);
});
Run Code Online (Sandbox Code Playgroud) 我有一些必须在表中的数据,以便我的应用程序工作,否则我收到一条错误消息.
例如,如果你或其他任何人从github拉我的应用程序,如果你运行php artisan migrate然后尝试测试应用程序你会得到一个错误:数据不存在或类似的东西.这是因为表中没有数据.
理想的解决方案是运行后:
php artisan migrate
Run Code Online (Sandbox Code Playgroud)
您还可以在该表中获得所需的数据.
这应该用播种机以某种方式完成,但我不知道如何.任何人都可以帮忙并举个例子吗?
如何为应该进入car_company表的数据制作种子:
id car_company
1大众汽车
2辆梅赛德斯
3奥迪
4保时捷
有4行,我想在运行后插入它们
php artisan db:seed
Run Code Online (Sandbox Code Playgroud) 我正在使用此页面上的SweetAlert2和第7个示例:
这个:
swal({
title: 'Are you sure?',
text: 'You will not be able to recover this imaginary file!',
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!',
closeOnConfirm: false
},
function() {
swal(
'Deleted!',
'Your file has been deleted.',
'success'
);
});
Run Code Online (Sandbox Code Playgroud)
像这样:
function deleteEvent(id)
{
swal({
title: 'Are you sure?',
text: 'You will not be able to recover this event!',
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!',
closeOnConfirm: false
}).then(function() …Run Code Online (Sandbox Code Playgroud) 我创建了一个自定义404错误页面,我正在使用我的app.layout来包装它.
但这很奇怪,因为当我收到404错误页面时,即使我已登录登录和注册链接.这是为什么?
当我登录我的页面并编写非现有路由时,我得到了扩展布局的404页面,但似乎Laravel无法访问Auth :: class,并且它不会看到用户是否登录.
因此,我没有看到Logout链接,而是看到"登录"和"注册"链接
laravel ×7
php ×2
git ×1
javascript ×1
jquery ×1
laravel-5 ×1
laravel-5.2 ×1
laravel-5.3 ×1
rounding ×1
sweetalert ×1