laravel-5.2

EventServiceProvider mapping for Laravel 5.2 login

狂风中的少年 提交于 2020-01-06 21:26:12
问题 I am trying to update user's last_login_at when a user login on Laravel 5.2. I used php artisan make:auth . I have app/Listeners/UpdateLastLoginOnLogin.php. namespace App\Listeners; use Carbon\Carbon; class UpdateLastLoginOnLogin { public function handle($user, $remember) { $user->last_login_at = Carbon::now(); $user->save(); } } And in app/Providers/EventServiceProvider: namespace App\Providers; use Illuminate\Contracts\Events\Dispatcher as DispatcherContract; use Illuminate\Foundation

EventServiceProvider mapping for Laravel 5.2 login

谁说胖子不能爱 提交于 2020-01-06 21:25:37
问题 I am trying to update user's last_login_at when a user login on Laravel 5.2. I used php artisan make:auth . I have app/Listeners/UpdateLastLoginOnLogin.php. namespace App\Listeners; use Carbon\Carbon; class UpdateLastLoginOnLogin { public function handle($user, $remember) { $user->last_login_at = Carbon::now(); $user->save(); } } And in app/Providers/EventServiceProvider: namespace App\Providers; use Illuminate\Contracts\Events\Dispatcher as DispatcherContract; use Illuminate\Foundation

Enable /register page to logged in users in Laravel 5.2

旧城冷巷雨未停 提交于 2020-01-06 21:01:11
问题 I need to enable /register page to logged in users and restrict for non logged in users in laravel 5.2. I tried changing \app\Http\Controllers\Auth\AuthController.php page constructer to view /register page to logged in users but it didn't work... public function __construct() { $this->middleware($this->guestMiddleware(), ['except' => ['logout', 'getRegister', 'postRegister']]); } It would be great help if someone can look into this. 回答1: You can add inside auth group middleware all your

Laravel job overwriting other jobs?

对着背影说爱祢 提交于 2020-01-06 07:28:10
问题 I'm not too sure how to word this one, but I've got a job called uploadFile , which uses CloudConvert to convert an uploaded file (e.g PDF) to a JPG. Used in isolation, it all works great. I can upload a file, it'll be saved to S3, then CloudConvert gets the S3 file, converts it and uploads that too. Perfect. When it's being used by more than one person at a time, the files get mixed up. The filenames are correct (so the variables themselves must be correct), but the actual image processed is

How to create download link for qr code image in Laravel?

大城市里の小女人 提交于 2020-01-06 05:47:06
问题 I am using Laravel 5.2 and Simple QR code library for creating QR code. It works fine. Now i want to download generated QR code. Inspect element shows: I can save this image, right click on image>save image . But i want to make a link so that i can download this image with clicking download link button. Same as: this mycode for creating qr code: <div class="text-center"> <img src="data:image/png;base64, {!! base64_encode(QrCode::format('png')->size(100)->generate('helloworld')) !!} "> <p>Scan

middleware.dev redirected you too many times

拥有回忆 提交于 2020-01-06 05:24:11
问题 I am running laravel version 5.4.26 my localhost project url is : middleware.dev . first time login in this url : middleware.dev/login ,and login successfully completed. Then enter this url : middleware.dev/admin ,then error message bellow This page isn’t working middleware.dev redirected you too many times. Try clearing your cookies. ERR_TOO_MANY_REDIRECTS Kernel.php <?php namespace App\Http; use Illuminate\Foundation\Http\Kernel as HttpKernel; class Kernel extends HttpKernel { /** * The

Session is expiring automatically in laravel 5.2

喜夏-厌秋 提交于 2020-01-06 04:59:08
问题 I am using larvel 5.2 for my application, i didn't used laravel authentication and wrote my own code, at the time of successful login i am storing user name in a session variable and checking this for every request after login. I didn't changed any session settings. My problem is session is expiring in lessthan 3mins and sometimes while login it is showing TokenMismatchException in VerifyCsrfToken.php line 67: remember only sometimes. After refresh the page everything become normal and after

Ways to prevent TokenMismatch Exception using AJAX in laravel

南笙酒味 提交于 2020-01-05 07:33:39
问题 I have analyze that ratio of getting Token Mismatch Error is very high. And this error getting because of some of the silly mistakes. There are many reasons developers are doing mistakes. Here are some of the examples. Not sending _token on header. Not sending _token on data when using ajax. Not Permission on Storage Path. Invalid Session Storage path. And there many other reasons, feel free to edit this question for more more ways to prevent this type of error. 回答1: Possible Change - 1 Setup

Call to undefined method (laravel 5.2)

别来无恙 提交于 2020-01-05 07:01:33
问题 I want to display friends of the user. But I am getting the following error: BadMethodCallException in Builder.php line 2345: Call to undefined method Illuminate\Database\Query\Builder::friends() FriendController: <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Http\Requests; use App\User; use Auth; class FriendController extends Controller { public function getIndex(){ $friends=Auth::user()->friends(); return view('friends',['friends'=>$friends]); } } Route: Route:

Connection could not be established with host smtp.gmail.com [Connection timed out #110] in laravel 5.2

别来无恙 提交于 2020-01-04 05:35:08
问题 I am trying to send an gmail with laravel 5.2. But it is throwing this error Swift_TransportException in StreamBuffer.php line 269: Connection could not be established with host smtp.gmail.com [Connection timed out #110] it work fine in localhost this my .env file MAIL_DRIVER=smtp MAIL_HOST=smtp.gmail.com MAIL_PORT=465 MAIL_USERNAME=my@gmail.com MAIL_PASSWORD=password MAIL_ENCRYPTION=ssl and this my mail.php <?php return [ /* |------------------------------------------------------------------