laravel-5.2

Laravel 5.2 Auth::check() on exception pages (layouts)

亡梦爱人 提交于 2019-12-24 03:02:18
问题 When I abort(404) Laravel 5.2 returns an error page. But when I call Auth::check() of Auth::user() through the dump() method it return null. But I want a custom error page with the current logged-in user on the screen (for example in the layouts/app.blade.php I want in the menu: Goodmorning username ). I tried to enable the web middleware on the app/exceptions/handler.php but that didn't work. Anny suggestions? 回答1: You could add custom error message: abort(404, 'ow noo, error 404'.Auth::user

Vue.js 2- sweet alert package simplert not working

眉间皱痕 提交于 2019-12-24 01:26:00
问题 I would like to use this library for alerts in my app built with Laravel 5.2 version. I have installed it and created a component like this: <script> import Simplert from 'vue2-simplert' export default { data () { return { obj: { title: 'Alert Title', message: 'Alert Message', type: 'info', useConfirmBtn: true, customConfirmBtnText: 'OK' }, } }, methods: { openSimplert () { this.$refs.simplert.openSimplert(this.obj) }, } } </script> I am registering the component in my app.js like this: Vue

Failure to update Laravel 5.1 to 5.2 (these conflict with your requirements or minimum-stability)

落爺英雄遲暮 提交于 2019-12-24 01:25:50
问题 Couple weeks ago I asked this question about trying to upgrade from Laravel 5.1 to 5.2 - Updating Larael from 5.1.35 to 5.2.* - fails to upgrade symfony/css-selector Although I was given very nice and clear answer, that did not help. As instructed, I have updated "lucadegasperi/oauth2-server-laravel" to "~5.1" , but I still have the same error. My composer.json { "name": "laravel/laravel", "description": "The Laravel Framework.", "keywords": [ "framework", "laravel" ], "license": "MIT", "type

Laravel upload Large images

自闭症网瘾萝莉.ら 提交于 2019-12-24 00:59:14
问题 I am trying to upload large images to server (binary file upload) via postman, it works fine for files sized 2 MB and below, however for files > 2 MB the upload fails I set php.ini upload_max_filesize = 100M post_max_size = 100M and nginx /etc/nginx/nginx.conf client_body_buffer_size 100M; client_max_body_size 100M; but it doesn't work I tried plupload package for chunk upload but it also doesn't work for files > 2 MB Any ideas how to upload large images in laravel ? 回答1: It's doen't work

Joining Model with Table Laravel 5.2

我是研究僧i 提交于 2019-12-24 00:58:14
问题 I have created a model in Laravel. class deals extends Model { // protected $table = 'tbl_deal'; } Now I want to use this model to retrieve data in my Controller. However, the data extracted from this model also needs to be constrained by a column in another table. Below is the basic schema tbl_deal deal_id merchant_id deal_text tbl_merchant merchant_id merchant_url_text My current Controller has the following code to extract all deals from deals model. $deals = deals::all(); I want to

Laravel Task Scheduler across multiple servers without overlap

旧城冷巷雨未停 提交于 2019-12-23 19:16:17
问题 I am wondering if anyone has any experience with making the Laravel Task Scheduler work without overlapping across multiple servers. To put it in context: I have 3 API servers behind a load balancer. I know the task scheduler allows for the withoutOverlap flag on a single server, but how could I use that same principal across all of my servers? I want only 1 server to run the scheduled tasks and have the other 2 servers not run them. As far as I can tell, my options are: Remove the crontab

Laravel socialite $user->getId()?

99封情书 提交于 2019-12-23 19:03:43
问题 I'm not sure if this is what is really causing my issue, but perhaps someone will know. When I use Laravel Socialite and go: $social_user = Socialite::driver($provider)->user(); Then somewhere else in my code is do this: if ($authUser = User::where('provider_id', $social_user->id)) return $authUser; For some crazy reason I get an error like this: Argument 1 passed to Illuminate\Auth\SessionGuard::login() must implement interface Illuminate\Contracts\Auth\Authenticatable, instance of

TokenMismatch Error on Ajax Requests in Laravel

随声附和 提交于 2019-12-23 18:13:38
问题 I am getting TokenMismatch Error on Ajax Submit when I submit form it gives me error. Here I am using Laravel 5.2 . Where I am passing X-CSRF-TOKEN on ajax call. Set Token on on meta on default.blade.php . I've tried all possible solutions from StackOverflow . Changing permission of storage folder. Tried clearing cache. Try adding Route::group(['middleware' => ['web','auth']], function () { Adding token to header of ajax function. Tried adding token field inside form. Can anyone find any

How do I change startRow for maatwebsite's laravel excel package 2.0.8 for Laravel 5.2 somewhere besides the excel.php config file?

与世无争的帅哥 提交于 2019-12-23 17:52:23
问题 I am trying to import an excel file using maatwebsite's laravel excel package 2.0.8 for Laravel 5.2. I would like to be able to change the startRow inside my controller instead of inside the config so it doesn't affect everyone. public function import() { $results = Excel::load('doctors.csv', function($reader) { })->get(); } 回答1: You can try this before reading the file: config(['excel.import.startRow' = rowNumber]); It worked for me. Source: https://github.com/Maatwebsite/Laravel-Excel

Log failed login attempts with Laravel 5.2

感情迁移 提交于 2019-12-23 12:17:38
问题 How would I log failed login attempts with laravel 5.2 I have the auth scaffolding installed. I have added the following to my EventsServiceProvider.php protected $listen = [ 'Illuminate\Auth\Events\Attempting' => [ 'App\Listeners\LogAuthenticationAttempt', ], 'Illuminate\Auth\Events\Login' => [ 'App\Listeners\LogSuccessfulLogin', ], 'Illuminate\Auth\Events\Logout' => [ 'App\Listeners\LogSuccessfulLogout', ], 'Illuminate\Auth\Events\Lockout' => [ 'App\Listeners\LogLockout', ], ]; And in my