小编AVI*_*AVI的帖子

Laravel 表单请求:调用错误的方法

当我使用带有 Post 方法的表单请求时,响应是“ index()”方法响应。但它必须是“ store(myRequest $request)”方法。如果我从“ store()”中删除 myRequest $request 方法,它就可以工作。我迷路了,请帮帮我。

我的控制器:

<?php namespace App\Http\Controllers\Ressource;

use App\Http\Requests\CreateCollectionRequest;
use App\Repositories\CollectionRepository;

class CollectionController extends RessourceController {

    private $collectionRepository;

    public function __construct(CollectionRepository $collectionRepository)
    {
        parent::__construct();
        $this->collectionRepository = $collectionRepository;
    }

    public function index()
    {
        return $this->run( function()
        {
            return $this->collectionRepository->all()->get();
        });
    }

    public function store(CreateCollectionRequest $request)
    {
        return $this->run( function() use ($request) {
        return $this->collectionRepository->create($request->all());
        });
    }
}
Run Code Online (Sandbox Code Playgroud)

资源控制器:

<?php namespace App\Http\Controllers\Ressource;

use Illuminate\Support\Facades\Response;
use App\Http\Controllers\Controller;

abstract class RessourceController extends Controller
{ …
Run Code Online (Sandbox Code Playgroud)

php laravel postman laravel-5 laravel-5.1

5
推荐指数
1
解决办法
702
查看次数

如何在数据表中动态更改导出文件名?

 $("#dataTable").DataTable({                    
                    dom: 'Bfrtip',
                    buttons: [
                             { extend: 'excel', text:'export to excel',title:'1'},
                    ],
})
Run Code Online (Sandbox Code Playgroud)

我可以通过以下代码更改按钮的文本,但无法获取 title 属性。

var table= $("#dataTable").DataTable();
tabele.button(0).text('excel');
Run Code Online (Sandbox Code Playgroud)

filenames export button datatables

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

Laravel中间件获取路由参数

我正在编写像"学校俱乐部管理系统"这样的东西,并在资源的权利授权上遇到一些问题.

假设有club,并且club有经理,我想在club用中间件管理之前检查用户是否是经理.

使用laravel 5.2

router看起来像那样:

Route::resource('club', 'ClubController');

我创建的中间件看起来像这样:

  public function handle($request, Closure $next)
    {
        if (!Auth::check()){
            // ask user to login
        }

        $club = Club::findOrFail($request->input('club'));
        $user = Auth::user();

        if (!$club->managers->contains($user)){
            //tell user your are not manager .
        }

        return $next($request);
}
Run Code Online (Sandbox Code Playgroud)

但我没能得到俱乐部的身份requests.

我该如何解决这个问题?

提前致谢 .

php laravel

5
推荐指数
2
解决办法
4732
查看次数

在Linux上安装tensorflow

我正在尝试在Linux上安装Tensorflow.不幸的是,我几乎无法使用Ubuntu.

我点击了" https://www.tensorflow.org/versions/master/get_started/os_setup.html#create-the-pip-package-and-install " 页面

我被困在"创建pip包并安装"部分.当我输入" bazel build -c opt //tensorflow/tools/pip_package:build_pip_package"终端给我下面

No command 'bazel' found, did you mean:
 Command 'babel' from package 'openbabel' (universe)
 Command 'babel' from package 'babel-1.4.0' (universe)
bazel: command not found
Run Code Online (Sandbox Code Playgroud)

它出什么问题了?

tensorflow

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

laravel中make控制器出错

我想学习拉维尔请帮忙.

使用laravel版本5.0.16.

php artisan make:controller Admin\Controller --resource
Run Code Online (Sandbox Code Playgroud)

它显示了这个错误:

[RuntimeException]"--resource"选项不存在.

问题是什么?

有什么不同?

php artisan make:controller Admin\Controller --resource

php artisan make:controller Admin\Controller --plain

php artisan make:controller Admin\Controller
Run Code Online (Sandbox Code Playgroud)

laravel

5
推荐指数
1
解决办法
4041
查看次数

svn.remote.RemoteClient.info: FileNotFoundError: [WinError 2] 系统找不到指定的文件

我正在尝试连接 SVN 远程客户端并使用 Windows 中的以下 python 代码获取最新提交的修订版:

r = svn.remote.RemoteClient(svnPath)
revNum = str(r.info().get("commit#revision"))
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

在 \n revNum = str(r.info().get("commit#revision"))\n', ' File "C:\Program Files\Python36\lib\site-packages\svn-0.3.45-py3 .6.egg\svn\common.py", line 75, in info\n do_combine=True)\n', ' File "C:\Program Files\Python36\lib\site-packages\svn-0.3.45- py3.6.egg\svn\common.py", line 54, in run_command\n return self.external_command(cmd, environment=self.env , **kwargs)\n', ' File "C:\Program Files\ Python36\lib\site-packages\svn-0.3.45-py3.6.egg\svn\common_base.py", line 25, in external_command\n env=env)\n', ' File "C:\Program Files \Python36\lib\subprocess.py", line 709, in __init \n
restore_signals, start_new_session)\n', ' File "C:\Program Files\Python36\lib\subprocess.py",第 997 行,在 _execute_child 中\n
startupinfo)\n']: [WinError 2] 系统找不到指定的文件

我试图打印“ svnpath”和“ …

python svn

5
推荐指数
1
解决办法
1335
查看次数

3D无限亚军游戏平台生成给出了例外

情况:我指的是项目的教程,代码中有一个对象池概念.

问题:在我编写生成平台(PlatformManager.cs)脚本之后,我得到一个例外,

InvalidOperationException:由于对象的当前状态,操作无效System.Collections.Generic.Queue`1 [UnityEngine.Transform] .Peek()PlatformManager.Update()(在Assets/Platform/PlatformManager.cs:35)

PlatformManager.cs脚本:

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class PlatformManager  : MonoBehaviour {
    public Transform prefab;
    public int numberOfObjects;
    public float recycleOffset;
    public Vector3 startPosition;
    public Vector3 minSize, maxSize,minGap, maxGap;
    public float minY, maxY;
    private Vector3 nextPosition;
    private Queue<Transform> objectQueue;

    void Start () {
        objectQueue = new Queue<Transform>(numberOfObjects);
        for (int i = 0; i < numberOfObjects; i++) {
            objectQueue.Enqueue((Transform)Instantiate(prefab));
        }
        nextPosition = startPosition;
        for (int i = 0; i …
Run Code Online (Sandbox Code Playgroud)

c# infinite-loop unity-game-engine object-pooling

4
推荐指数
1
解决办法
552
查看次数

如何在Qcombobox [python]中刷新项目?

我有一个显示在Qcombobox中的数据列表(使用'addItems')现在 - 如果通过从带有按钮的文件加载数据来更改列表 - 我在组合框中看不到新数据.新数据在那里(我可以在加载后打印)我想念什么?下面是简化gui的代码

from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QFileDialog
import pandas as pd

try:
    _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
    def _fromUtf8(s):
        return s

try:
    _encoding = QtGui.QApplication.UnicodeUTF8
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig)

class Ui_MainWindow(object):
    def __init__(self):
        self.comboData=['None']

    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(456, 172)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))

        self.comboBox = QtGui.QComboBox(self.centralwidget)
        self.comboBox.setGeometry(QtCore.QRect(120, 60, 69, 22))
        self.comboBox.setObjectName(_fromUtf8("comboBox"))
        self.comboBox.setEditable(True)
        self.comboBox.addItems(self.comboData)

        self.pushButton = QtGui.QPushButton(self.centralwidget)
        self.pushButton.setGeometry(QtCore.QRect(260, …
Run Code Online (Sandbox Code Playgroud)

python pyqt

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

CSS未在Laravel 5.2中加载

情况:

我正在使用Laravel创建一个Web应用程序,但目前我创建的CSS没有加载.

文件夹结构

在此输入图像描述

Laravel版本

Laravel Framework版本5.2.36

master.blade.php代码

 <!doctype html>
<html lang="en">
  <head>
      <meta charset="UTF-8">
      <title>@yield('title')</title>
      <link rel ="stylesheet" href= "{{ URL::secure('src/css/main.css') }}">
    @yield('styles')
  </head>
<body>
  @include('includes.header')
<div class="main">
    @yield('content')
    </div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

html css php laravel laravel-5.2

0
推荐指数
1
解决办法
443
查看次数

href不起作用,使用反应路由器

我正在尝试为弹出模块提供一个单独的URL,我正在使用一个按钮来重定向:

trigger={ <Link href="/exercisesadd">
          <Button style={style} waves='light' > Add new</Button></Link>
        }>
Run Code Online (Sandbox Code Playgroud)

但我收到404错误,即使我在反应路由器中有这条路线:

    export default () => {
    return <Route path="/"component={Container} auth={auth}>
        <IndexRoute component={Home}/>
        <Route path="/portfolio"  onEnter={requireAuth} component={Portfolio} />
        <Route path="/Login" component={Home} />
        <Route path="/home" component={Home}  />
        <Route path="/edit" component={Edits}/>
        <Route path="/exercises" component={Exercises}/>
        <Route path="/exercisesadd" component={Exercises}/>
    </Route>
};
Run Code Online (Sandbox Code Playgroud)

popup hyperlink uinavigationcontroller reactjs react-router

0
推荐指数
1
解决办法
5093
查看次数