laravel-5.4

Laravel 5.4 TokenMismatchException in VerifyCsrfToken.php line 68

青春壹個敷衍的年華 提交于 2019-11-28 01:52:00
问题 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'

Laravel Route issues with Route order in web.php

一个人想着一个人 提交于 2019-11-28 01:43:50
问题 I have problem with routes in Laravel, I'm following one tutorial and we have this routes listed in web.php file Route::get('/home', 'HomeController@index')->name('home'); Route::get('/blog', 'BlogController@index')->name('blog'); Route::get('/blog/create', 'BlogController@create'); Route::post('/blog/store', 'BlogController@store'); Route::get('/blog/{id}', 'BlogController@show'); Route::get('/blog/{id}/edit', 'BlogController@edit'); Route::patch('/blog/{id}', 'BlogController@update'); Route

laravel 5.4 embed image in mail

心不动则不痛 提交于 2019-11-27 23:18:57
问题 I have just upgraded my 5.2 install of laravel to 5.3 and then to 5.4 following the official upgrading methods. I am now trying to use one of the new features, to create a markdown formated email. According to the documentation found at: https://laravel.com/docs/5.4/mail#view-data To embed an inline image, use the embed method on the $message variable within your email template. Laravel automatically makes the $message variable available to all of your email templates, so you don't need to

Laravel: validate json object

前提是你 提交于 2019-11-27 23:15:09
It's the first time i am using validation in laravel. I am trying to apply validation rule on below json object. The json object name is payload and example is given below. payload = { "name": "jason123", "email": "email@xyz.com", "password": "password", "gender": "male", "age": 21, "mobile_number": "0322 8075833", "company_name": "xyz", "verification_status": 0, "image_url": "image.png", "address": "main address", "lattitude": 0, "longitude": 0, "message": "my message", "profession_id": 1, "designation_id": 1, "skills": [ { "id": 1, "custom" : "new custom1" } ] } And the validation code is

Two different models for authentication in laravel 5.4

亡梦爱人 提交于 2019-11-27 22:51:11
问题 Suppose I have two different models and tables named user and company . As you know laravel uses User model to manage Authentication. but beacause I have two different model I want can manage them separately. I'm using laravel 5.4 and I do not know how can do that. 回答1: If you are talking about multiple authentication system, then you have to create multiple guards to achieve that. There is nice answer to the same question. Can anyone explain Laravel 5.2 Multi Auth with example It's on

How to integrate Facebook PHP SDK with Laravel 5.4?

ε祈祈猫儿з 提交于 2019-11-27 19:52:11
问题 I was searching for an easy way to integrate Facebook PHP SDK with Laravel 5.4. Essentially, I wanted to make it available as a service within my Laravel app. Of course there is SammyK/LaravelFacebookSdk on github. But for some reason I didn't want to use it. I felt the setup was adding another layer that I would have to understand, and work within the constraints. There is also Laravel's own Socialite package. But this is essentially for simple authentication only. If I want to upload photos

Laravel 5.4 : Get logged in user id inside __construct()

最后都变了- 提交于 2019-11-27 15:44:57
I am trying to access Auth::user()->id; inside constructor but it always return the error Trying to get property of non-object . I study in the laravel documentation that Session is not accessible inside constructor and also search on SO for this. I need logged in user id inside constructor because I have to fetch data from database and make it available for all its method. My current code is : public function __construct(){ $this->middleware('auth'); $induction_status = TrainingStatusRecord::where('user_id',Auth::user()->id)->where('training','=','induction')->get(); View::share('ind_status',

Laravel 5.4 - How to customize notification email layout?

扶醉桌前 提交于 2019-11-27 13:37:30
I am trying to customize the HTML email layout that is used when sending notifications via email. I have published both the mail and notification views. php artisan vendor:publish --tag=laravel-mail php artisan vendor:publish --tag=laravel-notifications If I modify the /resources/views/vendor/notifications/email.blade.php file, I can only change the BODY content of the emails that get sent. I am looking to modify the footer, header, and every other part of the email layout as well. I tried also modifying the views inside /resources/vendor/mail/html/ , but whenever the notification gets sent,

laravel 5.4 upload image

吃可爱长大的小学妹 提交于 2019-11-27 12:49:49
问题 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

PHP7 : install ext-dom issue

岁酱吖の 提交于 2019-11-27 10:54:12
I'm running laravel 5.4 on Ubuntu 16.04 server with PHP7. trying to install cviebrock/eloquent-sluggable package throw some error: pish@let:/home/sherk/ftp/www$ sudo composer require cviebrock/eloquent-sluggable Do not run Composer as root/super user! See https://getcomposer.org/root for details Using version ^4.2 for cviebrock/eloquent-sluggable ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Your requirements could not be resolved to an installable set of packages. Problem 1 - phpunit/php-code-coverage 4.0