-
Notifications
You must be signed in to change notification settings - Fork 4
Installation Instructions
In your Laravel application, edit the composer.json
file. At the bottom, add or replace the line "minimum-stability": "stable"
by:
// bottom of your composer.json file, don't copy/paste this comment!
"minimum-stability": "dev",
"prefer-stable": true
}
See this file for a concrete example.
Then install the jQuery Laravel package:
composer require efficiently/jquery-laravel:2.5.*
If your Laravel version is below 5.5, add this service provider to your config/app.php
file:
Efficiently\JqueryLaravel\JqueryLaravelServiceProvider::class,
You can now add this security Middleware to the $middleware
variable, in your app/Http/Kernel.php
file:
protected $middleware = [
//...
\Efficiently\JqueryLaravel\VerifyJavascriptResponse::class,
];
Then, edit your app/Http/Controllers/Controller.php
file to add the Efficiently\JqueryLaravel\ControllerAdditions
trait:
//...
class Controller extends BaseController
{
//...
use \Efficiently\JqueryLaravel\ControllerAdditions;
/**
* The default layout path that should be used for responses.
* You should run this command, if you don't have a resources/views/layouts/app.blade.php file:
* php artisan make:auth
*/
protected $layout = 'layouts.app';
//...
}
Since Laravel 5.3.29, if you get this Error Exception:
Missing argument 1 for App\Http\Controllers\Controller::redirectTo(),
called in /home/username/my_app/vendor/laravel/framework/src/Illuminate/Foundation/Auth/RedirectsUsers.php on line 15
and defined in /home/username/my_app/vendor/efficiently/jquery-laravel/src/Efficiently/JqueryLaravel/ControllerAdditions.php line 93
Here the workaround:
In your app/Http/Controllers/Auth/LoginController.php
, app/Http/Controllers/Auth/RegisterController.php
and app/Http/Controllers/Auth/ResetPasswordController.php
files , you should replace the redirectTo()
call to redirectUserTo()
.
//...
class LoginController extends Controller
{
//...
/**
* Get the post register / login redirect path.
* And keep Efficiently\JqueryLaravel\ControllerAdditions::redirectTo()
*
* @see https://github.com/efficiently/jquery-laravel/issues/1
* @return string
*/
public function redirectPath()
{
if (method_exists($this, 'redirectUserTo')) {
return $this->redirectUserTo();
}
return property_exists($this, 'redirectTo') ? $this->redirectTo : '/home';
}
}
So the ControllerAdditions::redirectTo()
method works again 😸
Source: https://github.com/laravel/framework/pull/16896
Then, you should read this page Complete tutorial with the Larasset package
Or read one of these pages to configure Laravel Elixir or Laravel Mix