我无法理解,如何设置Form动作以指向特定控制器的功能.
这是我的刀片代码:
{{ Form::open(array('route'=>'user.search')) }}
Run Code Online (Sandbox Code Playgroud)
但我得到这个错误:
Unable to generate a URL for the named route "user.search" as such route does not exist.
Run Code Online (Sandbox Code Playgroud)
controller(UserController)具有此原型的功能
public function search(){ ... }
Run Code Online (Sandbox Code Playgroud)
我还尝试在route.php中设置这样的路由
Route::post('user/search', 'UserController@search');
Run Code Online (Sandbox Code Playgroud)
这段代码有什么问题?
我在视图中有以下复选框
<div class="form-group">
<label class="col-md-4 control-label">Roles</label>
<div class="col-md-6 col-md-offset-4">
<div class="checkbox">
<label>
<input type="checkbox" name="data_entry"> Data Entry <br />
<input type="checkbox" name="save_on_ext_hd"> Save On External HD <br />
<input type="checkbox" name="print"> Print <br />
<input type="checkbox" name="export_csv">Export CSV <br />
<input type="checkbox" name="delete"> Delete
</label>
</div>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我正在使用laravel 5和刀片模板.
问题是:当点击任何复选框时,第一个选中,反之亦然
例如:单击pn print复选框时,data_entry会自动检查,如果未选中,则取消选中print data_entry.
当检查打印data_entry时,以及检查删除时,例如data_entry未选中.
我需要在不重新加载页面的情况下调用控制器上的方法。问题在这里,我有一个 jwplayer 通过 Rss 从控制器接收播放列表,然后当播放列表结束时我需要从控制器获取另一个播放列表,但我无法刷新页面(这是更简单的方法),因为播放器不要自动全屏。
我该怎么做。
谢谢。
我是laravel的新手,正在做一个样本项目作为学习目的.我使用命令创建了身份验证:
php artisan make:auth
Run Code Online (Sandbox Code Playgroud)
我已经在Authcontroller.php中为所有成功的登录/注册提供了重定向链接:
protected $redirectTo = '/admin';
Run Code Online (Sandbox Code Playgroud)
所有这些都工作正常,我的问题是当我尝试使用laravel 5.2内置auth控制器上的密码重置选项重置密码时,我可以使用新密码重置旧密码.但重置密码后,它会被重定向到examplelaravel.com/home这样的链接.根据我在Authcontroller.php中的重定向链接(protected $ redirectTo ='/ admin';)fgiven,它不会发送到examplelaravel.com/admin.
在浏览我的laravel项目中的每个文件时,我看到一个名为vendor\laravel\framework\src\Illuminate\Foundation\Auth\RedirectsUsers.php的文件,其中包含如下方法:
public function redirectPath()
{
if (property_exists($this, 'redirectPath')) {
return $this->redirectPath;
}
return property_exists($this, 'redirectTo') ? $this->redirectTo : '/home';
}
Run Code Online (Sandbox Code Playgroud)
我在上述文件中将/ home更改为/ admin,并且在成功修改密码后我的重定向问题得到修复.但我不知道这是否是正确的方法?是否正确编辑供应商文件夹内的文件,就像我上面所做的那样?请帮我.提前致谢.
如何将通配符子域添加到我已创建的网站?当你第一次创建一个时,我知道你可以选中一个复选框,但事后你如何做到这一点?我必须编辑 NGINX 配置文件吗?
我厌倦了将其放在该server{}部分中:server_name ~^(.*)\.mydomain\.com$ ;但它不起作用。我一直使用 .htaccess 所以我对 NGINX 不太熟悉
我尝试过的 NGINX 配置文件
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name mydomain.com;
server_name ~^(.*)\.mydomain\.com$
root /home/forge/mydomain.com/public;
# FORGE SSL (DO NOT REMOVE!)
ssl_certificate /etc/nginx/ssl/mydomain.com/321141/server.crt;
ssl_certificate_key /etc/nginx/ssl/mydomain.com/321141/server.key;
MORE BELOW
Run Code Online (Sandbox Code Playgroud)
如果我访问,mydomain.com我会得到我的网站,但如果我访问 app.mydomain.com,我会得到server IP address could not be found.. 在我的本地环境中,我有子域路由,因此当我使用 Valet 转到该子域时,它可以工作。
在我的 Laravel 应用程序中,一个简单的 eloquent 调用会为我表中的新项目生成一个新 id。 $Article = new Article;
如果我还想同时生成自定义代码,我该怎么做?
我试过这个:
protected $fillable = [
'RandomReference' => substr(md5(rand()), 0, 7),
...
Run Code Online (Sandbox Code Playgroud)
但得到这个错误: Constant expression contains invalid operations
如果我将其设为受保护的字段(而不是可填写的)也无济于事。
正如标题所述,我无法让我的网站重定向.我做了几次尝试,即将失去它.
我的.htaccess文件如下:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L]
Run Code Online (Sandbox Code Playgroud)
我将此文件放在www/Laravel/public文件夹以及www目录中
我的主机文件如下
127.0.0.1 localhost
Run Code Online (Sandbox Code Playgroud)
这是routes.php中包含的路由代码
Route::get('authors', array('uses'=>'authors@index'));
Run Code Online (Sandbox Code Playgroud)
我有一个名为authors.php的控制器,这里是代码
class Authors_Controller extends Base_Controller {
public $restful = true;
public function get_index () {
return View::make('authors.index');}
}
Run Code Online (Sandbox Code Playgroud)
我正在使用Windows 7旗舰版.我要把我的脑袋弄出来.请帮帮我,我很糟糕.
使用带有Eloquent的paginate时收到以下错误:
Argument 2 passed to Illuminate\Pagination\Factory::__construct() must be an instance of Illuminate\View\Factory, instance of Illuminate\View\Environment given, called in C:\****\vendor\laravel\framework\src\Illuminate\Pagination\PaginationServiceProvider.php on line 23 and defined
出于测试目的,这就是我在控制器方法中的全部内容:
return User::paginate(15);
Run Code Online (Sandbox Code Playgroud)
我从文档中了解升级过程,但我没有提到任何参考文献.
更新:
在我的特定情况下,工作台中有一个包需要Illuminate 4.1组件,我在composer.json中更改为4.2,删除了供应商目录和composer.lock文件,安装了作曲家,错误消失了.
这些操作都在包文件夹中完成.