我尝试使用Laravel 5将数据保存到mysql时出现此错误,其他表单和save()方法工作正常,但这一个:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'sistemal5.cotizacions' doesn't exist (SQL: insert into `cotizacions` (`customer_id`, `total`, `updated_at`, `created_at`) values (1501, 150.69, 2015-05-11 03:16:25, 2015-05-11 03:16:25))
Run Code Online (Sandbox Code Playgroud)
这是我的Controller存储方法:
public function store(CotFormRequest $request)
{
$quote = new Cotizacion;
$quote->customer_id = Input::get('data.clientid');
$quote->total = Input::get('data.totalAftertax');
$quote->save();
}
Run Code Online (Sandbox Code Playgroud)
这是我的模型:
<?php namespace App\Models\Cotizacion;
use Illuminate\Database\Eloquent\Model;
class Cotizacion extends Model {
}
Run Code Online (Sandbox Code Playgroud)
我必须忽略一些非常明显的东西,因为我无法理解为什么Laravel正在添加一个"S"表格是cotizacion而不是cotizacions.
我怎么解决这个问题?
我在POST中的'Cylinders'数据数组中得到一个数组:
Array
(
[serie] => Array
(
[0] => 1234
[1] => 3545
)
[seriesap] => Array
(
[0] => 1234234
[1] => 345345
)
[type] => Array
(
[0] => 4546
[1] => csdfwe
)
[admission] => Array
(
[0] => 04-05-2015
[1] => 04-05-2015
)
[invoice] => Array
(
[0] => fei76867
[1] => feiasodjf
)
)
Run Code Online (Sandbox Code Playgroud)
现在,键内的字段:系列,类型,入场等不会改变,但这些键内的信息确实发生变化,我的意思是那里甚至可能有15个项目.
最后我需要保存到数据库:
$cylinder = new Cylinder();
$cylinder->serie = ??;
$cylinder->seriesap = ??;
$cylinder->type = ??;
$cylinder->admission = ??;
$cylinder->invoice = ??; …
Run Code Online (Sandbox Code Playgroud) 我在 BitBucket 上有一个私有仓库,我尝试使用 composer install 在本地主机上安装,这是我的 composer.json 文件:
{
"repositories": [
{
"type": "git",
"url": "git@bitbucket.org:username/repo.git"
}
]
}
Run Code Online (Sandbox Code Playgroud)
当我从命令行运行 composer install 时,我得到:
[RuntimeException] 无法执行 git clone --mirror "git@bitbucket.org:username/repo.git" "C:/Users/...../" 克隆到裸仓库 'C:/Users/... ..'... 权限被拒绝(公钥)。致命:无法从远程存储库读取。请确保您拥有正确的访问权限并且存储库存在。
我的密钥对有一个密码短语,但 composer 从不要求它,我正在运行 Windows 10,同时运行 Pageant 客户端并选择了正确的密钥。
还有一个包含此数据的配置文件:
Host bitbucket.org
IdentityFile ~/.ssh/openssh (yes my key name is openssh)
Run Code Online (Sandbox Code Playgroud)
有趣的是,如果我复制并粘贴此命令:
git clone --mirror "git@bitbucket.org:username/repo.git"
我确实被要求输入密码,然后它开始克隆 Repo。
可能有什么问题?有关此错误的大多数信息直接针对 git 命令,但在我的情况下,它们有效,无效的是作曲家,我做错了什么?
我不知道怎么了,我有这个JavaScript函数:
<script charset="utf-8" type="text/javascript">
$(document).ready(function(){
//initialize the javascript
App.init();
@if(Session::has('message'))
var msg = '{{ Session::get('message') }}';
console.log(msg);
swal({
title: "",
text: 'compañia',
type: "warning",
confirmButtonText: "Ok!",
closeOnConfirm: false
});
$(window).bind("load", function() {
$.gritter.add({
title: 'Atencion',
text: 'compañia',
image: '{{ asset('images/clipboard_icon.png') }}',
class_name: 'danger',
time: ''
});
return false;
});
@endif
});
</script>
Run Code Online (Sandbox Code Playgroud)
问题在于,甜蜜警报没有显示:'compañia'
它显示了,'compañia'
但是gritter消息正确显示了该单词。(见图片)
如您所见,红色的抱怨者正确地显示了该词,但甜蜜的警告却没有,
该文件是UTF-8编码的,因此元和脚本也是以防万一,在您问我为什么'compañia'
要将它放在会话中由Laravel发送并由视图以这种格式检索的较大消息的一部分时,它也是这样。
无论如何,我真正的问题是,为什么粗砂纸会显示出很好的单词,我该如何解决这个问题,使其在发出甜蜜警报时也能正常工作。
php ×3
laravel ×2
mysql ×2
arrays ×1
bitbucket ×1
composer-php ×1
git ×1
javascript ×1
laravel-5 ×1
sweetalert ×1
utf-8 ×1