小编kyo*_*kyo的帖子

在Laravel中回滚一个特定的迁移

我想要

仅回滚:

Rolled back: 2015_05_15_195423_alter_table_web_directories


我跑

php artisan migrate:rollback,我的3个迁移正在回滚.

Rolled back: 2015_05_15_195423_alter_table_web_directories
Rolled back: 2015_05_13_135240_create_web_directories_table
Rolled back: 2015_05_13_134411_create_contacts_table
Run Code Online (Sandbox Code Playgroud)

我删除了

无意中我web_directories和我的contacts桌子.可悲的是,我从来不希望这种情况发生,如果我只能回滚那个特定的那个,那么这场灾难将永远不会发生.


我希望

有人可以教我如何防止这种情况再次发生.

任何建议将不胜感激.

database-migration laravel laravel-4 laravel-5

201
推荐指数
11
解决办法
13万
查看次数

访问被拒绝用户'宅基'@'localhost'(使用密码:是)

我使用Laravel 5.0在Mac OS Yosemite上.

在我的本地环境中,php artisan migrate我一直在运行:

在此输入图像描述

组态

这是我的.env

APP_ENV=local
APP_DEBUG=true
APP_KEY=*****

DB_HOST=localhost
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
Run Code Online (Sandbox Code Playgroud)

应用程序\ CONFIG\database.php中

   'mysql'       => [
    'driver'      => 'mysql',
    'host'        => env('DB_HOST', 'localhost'),
    'database'    => env('DB_DATABASE', 'homestead'),
    'username'    => env('DB_USERNAME', 'homestead'),
    'password'    => env('DB_PASSWORD', 'secret'),
    'unix_socket' => '/tmp/mysql.sock',
    'charset'     => 'utf8',
    'collation'   => 'utf8_unicode_ci',
    'prefix'      => '',
    'strict'      => false,
    ]
Run Code Online (Sandbox Code Playgroud)

我该如何避免这种错误?

我试过了 :


1

app/database.php中

替换localhost127.0.0.1

'host'=> env('DB_HOST', 'localhost') - >'host' => env('DB_HOST', '127.0.0.1') …

php database-migration laravel laravel-5 homestead

155
推荐指数
17
解决办法
26万
查看次数

此API项目无权使用此API.请确保在API控制台中激活此API

我有一个纬度和经度:"-27.0000,133.0000".我希望根据它制作一个地图.

我试过去看看这个链接

https://maps.googleapis.com/maps/api/geocode/json?latlng=-27.0000,133.0000&key=******

我一直在浏览器上收到此错误

{
   "error_message" : "This API project is not authorized to use this API. Please ensure that this API is activated in the APIs Console: Learn more: https://code.google.com/apis/console",
   "results" : [],
   "status" : "REQUEST_DENIED"
}
Run Code Online (Sandbox Code Playgroud)

但我想我已经启用了这个API.我登录到我的Google控制台,然后仔细检查.

当我去: https://console.developers.google.com/project/75423435770063/apiui/apis/enabled

我知道了 :

启用地理编码+地理定位.

在此输入图像描述

我现在有点卡住了.我在这里错过了什么吗?

google-maps geocoding google-maps-api-3 google-geolocation

151
推荐指数
10
解决办法
23万
查看次数

Git说我删除远程分支时不存在远程引用

我跑了 git branch -a

* master
  remotes/origin/test
  remotes/origin/master
Run Code Online (Sandbox Code Playgroud)

我想删除我的远程分支

我试过了

git push origin --delete remotes/origin/test
Run Code Online (Sandbox Code Playgroud)

我有

错误:无法删除'remotes/origin/test':远程引用不存在

它怎么不存在?

我做了一个git branch -a,我看到它列出来了.

我错过了什么吗?

git

109
推荐指数
8
解决办法
8万
查看次数

将文本复制到剪贴板:无法读取未定义的读取“writeText”的属性

我有一个按钮

在此输入图像描述

当我点击复制时

copyImageLinkText({ mouseenter, mouseleave }, e) {
  this.showCopiedText = !this.showCopiedText
  navigator.clipboard.writeText(this.imageLink)

  clearTimeout(this._timerId)
  mouseenter(e)
  this._timerId = setTimeout(() => mouseleave(e), 1000)
},
Run Code Online (Sandbox Code Playgroud)

这条线似乎在我的 MacBook Pro 上本地运行得很好

navigator.clipboard.writeText(this.imageLink)
Run Code Online (Sandbox Code Playgroud)

当我构建并将其部署到我的开发服务器时,它不起作用。

类型错误:无法读取未定义的属性(读取“writeText”)

在此输入图像描述

javascript copy-paste vue.js vue-component vuejs2

57
推荐指数
1
解决办法
6万
查看次数

如何解决"您的要求无法解析为可安装的软件包"错误?

当我运行时,composer update我收到一些有线输出.

在此输入图像描述

这是我的composer.json看起来像.

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.", "keywords": ["framework", "laravel"],
    "license": "MIT",
    "repositories": [{
        "type": "vcs",
        "url": "https://github.com/Zizaco/ardent.git"
    }],
    "require-dev": {
        "phpunit/phpunit": "4.3.*"
    },
    "require": {
        "laravel/framework": "4.2.*", 
        "laravelbook/ardent": "dev-master as 2.4.0", 
        "zizaco/entrust": "dev-master", 
        "sebklaus/profiler": "dev-master", 
        "doctrine/dbal": "dev-master"
    },
    "autoload": {
        "classmap": [
            "app/commands",
            "app/controllers",
            "app/models",
            "app/database/migrations", "app/database/seeds", "app/tests",
            "app/libraries"
        ]
    },
    "scripts": {
        "post-install-cmd": [
            "php artisan clear-compiled", 
            "php artisan optimize"
        ],
        "post-update-cmd": [
            "php artisan clear-compiled", 
            "php artisan optimize"
        ],
        "post-create-project-cmd": [
            "php …
Run Code Online (Sandbox Code Playgroud)

laravel composer-php laravel-4

46
推荐指数
8
解决办法
15万
查看次数

libMobileGestalt MobileGestalt.c:890:此平台不支持MGIsDeviceOneOfType

我正在使用Xcode 9我在加载应用程序时遇到此错误

libMobileGestalt MobileGestalt.c:890:此平台不支持MGIsDeviceOneOfType.

怎么阻止?

xcode ios swift

37
推荐指数
1
解决办法
2万
查看次数

如何在Laravel 5中访问刀片中的URL段?

我有一个网址: http://localhost:8888/projects/oop/2

我想访问第一段 - > projects

我试过了

<?php echo $segment1 = Request::segment(1); ?>

刷新页面时,我的视图中看不到任何内容.


任何帮助/建议将不胜感激

php laravel blade laravel-5

36
推荐指数
5
解决办法
8万
查看次数

截断Laravel 5中的表格

描述:我有一个充满测试数据的表.有时,我想清除它以获取新数据.我可以像DB WorkBench一样在DBMS应用程序中执行截断,但我正在尝试在我的应用程序中实现它.


目标:在单击时创建一个按钮以截断数据库中的表.


这是我的步骤:

1 - 申报路线

Route::delete('visitor/truncate',array('as'=>'visitor.truncate', 'uses'=>'VisitorController@truncate'));
Run Code Online (Sandbox Code Playgroud)

2 - truncate在我的中创建一个函数VisitorController

public function truncate()
{

    $visitors = Visitor::all();
    $visitors ->truncate();

    return View::make('visitors.index')
        ->with('success', 'Truncate Done');
}
Run Code Online (Sandbox Code Playgroud)

3 - 在我的视图上创建一个按钮

 {!! Form::model($visitors, array( 'route' => array('visitor.truncate'),'method' => 'DELETE')) !!}
          <button type="submit"  class="btn bgm-red btn-float waves-effect waves-effect waves-button waves-float"><i class="md md-remove"></i></button>
      {!! Form::close()!!}
Run Code Online (Sandbox Code Playgroud)

4 - 测试

当我点击它时,它进入truncate()我的控制器中的功能,但我不断收到此错误

调用未定义的方法Illuminate\Database\Eloquent\Collection :: truncate()


我需要包含任何东西truncate()吗?

任何提示将非常感谢!

php laravel eloquent laravel-5

27
推荐指数
5
解决办法
5万
查看次数

如何在Sublime Text 3中对齐文本?

我使用名为AlignTab的 Sublime Text 3插件来对齐我的代码,如下所示:

 Version : 1.4.1
 Author  : Ken Wheeler
 Website : http://kenwheeler.github.io
 Docs    : http://kenwheeler.github.io/slick
 Repo    : http://github.com/kenwheeler/slick
 Issues  : http://github.com/kenwheeler/slick/issues
Run Code Online (Sandbox Code Playgroud)

现在,我希望我的文本像这样留在冒号旁边:

 Version: 1.4.1
  Author: Ken Wheeler
 Website: http://kenwheeler.github.io
    Docs: http://kenwheeler.github.io/slick
    Repo: http://github.com/kenwheeler/slick
  Issues: http://github.com/kenwheeler/slick/issues
Run Code Online (Sandbox Code Playgroud)

我该如何做到这一点?

sublimetext sublimetext3 sublime-text-plugin

24
推荐指数
2
解决办法
3万
查看次数