Tag: laravel

如何在Laravel 5中禁用注册新用户

我试图让Laravel 5中的单用户pipe理面板(只有一个用户),我注册了该用户,所以现在我想禁用新用户注册,当然login表单必须工作,但没有新的注册从今起。 我怎样才能做到这一点? 我使用默认的用户login和版本5注册。

Laravel雄辩的ORM交易

雄辩ORM是相当不错的,虽然我想知道是否有一个简单的方法来设置MySQL交易使用innoDB与PDO相同的方式,或者如果我不得不延长ORM使这成为可能?

php artisan migrate:make create_mytable失败:“migrate:make”未定义

在我的Laravel 5应用程序的根目录下运行以下命令时, php artisan migrate:make create_mytable 我得到以下错误: [InvalidArgumentException] Command "migrate:make" is not defined. Did you mean one of these? migrate:reset migrate:refresh migrate:status migrate:rollback migrate:install migrate Laravel 5有没有新的方法可以开始迁移?

Laravel – 会话存储未根据请求设置

我最近创build了一个新的Laravel项目,并沿着关于authentication的指南。 当我访问我的login或注册路线时,我得到以下错误: ErrorException in Request.php line 775: Session store not set on request. (View: C:\Users\Matthew\Documents\test\resources\views\auth\register.blade.php) 我没有编辑任何核心的Laravel文件,我只创build了视图,并添加了路线到我的routes.php文件 // Authentication routes Route::get('auth/login', ['uses' => 'Auth\AuthController@getLogin', 'as' => 'login']); Route::post('auth/login', ['uses' => 'Auth\AuthController@postLogin', 'as' => 'login']); Route::get('auth/logout', ['uses' => 'Auth\AuthController@getLogout', 'as' => 'logout']); // Registration routes Route::get('auth/register', ['uses' => 'Auth\AuthController@getRegister', 'as' => 'register']); Route::post('auth/register', ['uses' => 'Auth\AuthController@postRegister', 'as' […]

如何在Laravel 5.3中使用API​​路由

在Laravel 5.3中,API路由被移入了api.php文件。 但是我怎样才能在api.php文件中调用路由? 我试图创build一个这样的路线: Route::get('/test',function(){ return "ok"; }); 我尝试了以下URL但都返回了NotFoundHttpExceptionexception: http://localhost:8080/test/public/test http://localhost:8080/test/public/api/test 我怎样才能调用这个API的路线?

Laravel雄辩的“不在”

我很难在laravel eloquent ORM写查询。 我的查询是 SELECT book_name,dt_of_pub,pub_lang,no_page,book_price FROM book_mast WHERE book_price NOT IN (100,200); 现在我想把这个查询转换成laravel雄辩。

如何使用JSON通过Ajax请求使用Select2?

我的Select2 3.4.5不适用于JSON数据。 这是我在HTML上的input框: <input class='form-control col-lg-5 itemSearch' type='text' placeholder='select item' /> …和我的JavaScript $(".itemSearch").select2({ placeholder: "Search for an Item", minimumInputLength: 2, ajax: { url: "/api/productSearch", dataType: 'json', quietMillis: 100, data: function (term, page) { return { option: term }; }, results: function (data, page) { var more = (page * 10) < data.total; return { results: […]

防止Laravel将多个logging添加到数据透视表

我有一个多对多的关系设置和工作,添加一个项目,我用的车: $cart->items()->attach($item); 它将一个项目添加到数据透视表(应该如此),但是如果用户再次点击链接添加一个他们已经添加的项目,它会在数据透视表中创build一个重复的项目。 是否有内置的方式来添加一个数据透视表,只有当一个不存在? 如果没有,我怎样才能检查数据透视表,find一个匹配的logging是否已经存在?

Laravel Schema onDelete设置为null

无法弄清楚如何在Laravel的表上设置正确的onDelete约束。 (我正在和SqLite合作) $table->…->onDelete('cascade'); // works $table->…->onDelete('null || set null'); // neither of them work 我有3个迁移,创build图库表: Schema::create('galleries', function($table) { $table->increments('id'); $table->string('name')->unique(); $table->text('path')->unique(); $table->text('description')->nullable(); $table->timestamps(); $table->engine = 'InnoDB'; }); 创build图片表格: Schema::create('pictures', function($table) { $table->increments('id'); $table->text('path'); $table->string('title')->nullable(); $table->text('description')->nullable(); $table->integer('gallery_id')->unsigned(); $table->foreign('gallery_id') ->references('id')->on('galleries') ->onDelete('cascade'); $table->timestamps(); $table->engine = 'InnoDB'; }); 将图库表格链接到图片: Schema::table('galleries', function($table) { // id of a picture that is […]

如何在没有公开暴露/ app /文件夹的情况下将Laravel 4安装到虚拟主机子文件夹?

我想知道是否有人知道在Web主机SUBDIRECTORY /子文件夹中安装Laravel 4的方法,同时不会将/ app /文件夹和其他合理的文件暴露给主机的公开访问部分。 这个想法是,我可以访问http://mydomain.com/mylaravel/ ,以便能够使用Laravel,但同时我想避免任何人进入http://mydomain.com / app /或http://mydomain.com/mylaravel/app/ ,基本上可以看到我的configuration文件和其他代码。