laravel-5.4

How to make Laravel work with Redis cluster on AWS

情到浓时终转凉″ 提交于 2019-11-29 16:31:29
I'm trying to use Laravel (5.4) with a clustered version of Redis. I followed the instructions form this post like so: /* |-------------------------------------------------------------------------- | Redis Databases |-------------------------------------------------------------------------- | | Redis is an open source, fast, and advanced key-value store that also | provides a richer set of commands than a typical key-value systems | such as APC or Memcached. Laravel makes it easy to dig right in. | */ 'redis' => [ 'client' => 'predis', 'cluster' => 'true', 'default' => [ 'host' => env('REDIS

Laravel: left join query

随声附和 提交于 2019-11-29 16:25:08
I have such SQL query, which works fine: SELECT A.program_id FROM A LEFT JOIN B ON A.program_id = B.program_id WHERE B.program_id IS NULL But i want it to rewrite into LARAVEL style, like this: \DB::table('A') ->join('B', 'A.program_id', '=', 'B.program_id') ->select('A.program_id') ->whereNull('B.program_id') ->get()->toArray(); But this code returns me 0 results. You are using join instead of left join Try this \DB::table('A') ->leftjoin('B', 'A.program_id', '=', 'B.program_id') ->select('A.program_id') ->whereNull('B.program_id') ->where('A.student_id', '=', 5) ->get()->toArray(); It will

Lravel 5.4: JWT API with multi-auth on two tables one works the other not

爷,独闯天下 提交于 2019-11-29 15:31:40
问题 I am using... Laravel 5.4 tymon/jwt-auth : 1.0.0-rc.2 I have application with two authentications API one is customers and the other is drivers each one has it's own table. now let me describe shortly JWT package installation and the updates I did on it. I installed the package as described in the JWT documents exactly. Now comes to the quick start here I updated two Models one is the User and the second Driver . Comes here to the Configure Auth guard again I used the configuration for the

laravel 5.4 change authentication users table name

此生再无相见时 提交于 2019-11-29 09:54:53
问题 I'm currently using the laarvel5.4 authentication in my application; and I want to change the users table name while keeping its role as it is in the authentication logic, all I need is just to change the name. It seems that Laravel changer the Auth file and code structure in the latest version, so auth.php doesn't really look as in the previous versions of laravel. I have done the following so far, but it's still not working gy giving me an error saying that the table users doesn't exist: 1-

Laravel 5.4 TokenMismatchException in VerifyCsrfToken.php line 68

二次信任 提交于 2019-11-29 08:06:56
When I login for the first time it works perfectly but when I log out from my app and try to re-login I get this error. I've tried almost every available solutions but can't solve the issue. Any solution to fix this error? This is how I perform login and logout(Please correct me if the code is wrong as I'm new in laravel). I've tried laravel-caffeine and {{ csrf_token() }}. I think this is some session related issue. public function auth(Request $request) { $this->validate($request, [ 'email' => 'required|email|max:255', 'password' => 'required|min:6', ]); $data = $request->only('email',

Laravel 5.4 passport axios always returns Unauthenticated

爷,独闯天下 提交于 2019-11-29 07:55:26
I've followed the guide here: https://laravel.com/docs/5.4/passport#consuming-your-api-with-javascript Using axios: ... mounted: function() { axios.get('/api/user') .then(function (response) { console.log(response) }) .catch(function (response) { console.error(response); }); }, But the response is always unauthenticated, I check to see if a laravel_token cookie is present and it is: I'm running on apache2 ( docker ) ---- Update -- Upon debugging, its actually the xsrf token thats failing in this method in TokenGuard : /** * Authenticate the incoming request via the token cookie. * * @param

`npm run watch` not working in Laravel 5.4

家住魔仙堡 提交于 2019-11-29 06:00:19
问题 Using Laravel 5.4 and Mix, when I run npm run watch it compiles everything once and looks like it is waiting for changes, but when I make changes to any of my asset files it doesn't seem to detect anything. Is anyone else having this issue in 5.4 or have a solution? 回答1: The solution was provided by Jeffrey Way over at Laracasts. Try adding the --watch-poll flag to your package.json script. Or just try: node_modules/.bin/webpack --watch --watch-poll --config=node_modules/laravel-mix/setup

Script @php artisan package:discover handling the post-autoload-dump event returned with error code 1

微笑、不失礼 提交于 2019-11-29 02:02:35
问题 Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 0 installs, 0 updates, 1 removal - Removing genealabs/laravel-caffeine (0.3.12) Writing lock file Generating optimized autoload files Illuminate\Foundation\ComposerScripts::postAutoloadDump @php artisan package:discover [Symfony\Component\Debug\Exception\FatalThrowableError] Class 'GeneaLabs\LaravelCaffeine\LaravelCaffeineServiceProvider' not found Script @php artisan

laravel 5.4 upload image

家住魔仙堡 提交于 2019-11-28 20:15:39
My controller code for upload file in laravel 5.4: if ($request->hasFile('input_img')) { if($request->file('input_img')->isValid()) { try { $file = $request->file('input_img'); $name = rand(11111, 99999) . '.' . $file->getClientOriginalExtension(); $request->file('input_img')->move("fotoupload", $name); } catch (Illuminate\Filesystem\FileNotFoundException $e) { } } } Image was successfully uploaded but the code threw an exception : FileNotFoundException in MimeTypeGuesser.php line 123 The file is there any fault in my code or is it a bug in laravel 5.4, can anyone help me solve the problem ?

How to logout and redirect to login page using Laravel 5.4?

折月煮酒 提交于 2019-11-28 18:34:30
问题 I am using Laravel 5.4 and trying to implement authentication system. I used php artisan command make:auth to setup it. I edited the views according to my layout. Now, when I am trying to logout it throwing me this error NotFoundHttpException in RouteCollection.php line 161: could any one help me how to logout? 回答1: In your web.php (routes): add: Route::get('logout', '\App\Http\Controllers\Auth\LoginController@logout'); In your LoginController.php add: public function logout(Request $request)