Questions tagged [laravel-5.5]

Laravel 5.5 is a previous version, but the current LTS version, of the open-source PHP web framework created by Taylor Otwell. It was released on August 30, 2017. Use it in addition to the laravel-5 tag if your question is specific to Laravel 5.5. Use the laravel tag for general laravel related questions.

Laravel 5.5 is a previous version, but current LTS version, of Laravel 5. It was released on August 30,2017.

What is new:

  • New Whoops integration
  • Streamlined Request Validation
  • Fresh Migrations
  • Frontend Presets
  • Automatic Package Discovery
  • Silky Smooth Custom Validation Rules
  • Collection Dumping
  • Model Factory Generation
  • Custom Blade "If" Directives
  • Auto-Registering Artisan Commands
  • Higher Order Tap
  • Optional Objects
  • New API Resources

Resources:

2496 questions
12
votes
4 answers

laravel 5.5 Get user details inside constructor

I am building an application with multiple user roles and actions. I did follow the official laravel doc (https://laravel.com/docs/5.5/middleware#middleware-parameters). But in my controller's constructor (from where I call the above middleware) I…
HasilT
  • 2,463
  • 2
  • 17
  • 28
12
votes
17 answers

Laravel 5.5 login and register page says:The page has expired due to inactivity.[TokenMismatchException]

I just created a new project of laravel version 5.5 with the laravel installer.And run the command "php artisan make:auth".The views and controller are generated for the user authentication.And also run "php artisan migrate" to create tables needed…
brian.shen
  • 123
  • 1
  • 1
  • 4
11
votes
6 answers

Getting error while installing laravel installer in window 10

I am using Windows 10 and composer is installed. When I try to install laravel installer globally using this command: composer global require laravel/installer [Composer\Downloader\TransportException] The "https://repo.packagist.org/packages.json"…
Gurpal singh
  • 1,511
  • 1
  • 14
  • 27
11
votes
3 answers

laravel request validation rules pass parameter

I'm going straight to the point here, I am wondering if it is possible to pass a parameter on a validation rule in Laravel. Here's my code: I need to pass the $product->id to the ProductUpdateRequest class. I've read some articles and to no avail…
Sam Teng Wong
  • 2,379
  • 5
  • 34
  • 56
11
votes
6 answers

How to get current user in Laravel API using Passport?

I am using passport package for Laravel API Authentication. When I post data I get error: 401 Unauthorized","error":{"error":"Unauthenticated."}. I use Auth::user()->id; to get current user id. How to solve this error?
Karthik
  • 5,589
  • 18
  • 46
  • 78
11
votes
3 answers

Is there a way to assert current URL value in Laravel Dusk?

I'm testing a web application with subdomain routing with Laravel Dusk. I have some redirection between subdomain, if some kind of verification is invalid. So, my goal is to visit an URL $a then assert that I was redirected and the new URL is $b. I…
rap-2-h
  • 30,204
  • 37
  • 167
  • 263
11
votes
1 answer

phpunit tests run using PHP7.2 and 7.1 are 3x slower than when run using PHP7.0

If I run my tests using PHP7.2 or PHP7.1 they are about 3x slower than if I run them using PHP7.0. Is there anyway to get to the bottom of why this is happening? Even when I run the test suites (Feature & Unit) separately I still see the slow down.…
Michael
  • 4,282
  • 9
  • 55
  • 89
11
votes
4 answers

pagination not styled in laravel 5.5

Here is my code where I am showing the paginations of my blog posts !!
{{ $posts->render() }} Older Posts →
Here is the controller where the pagination…
Muhammad Hamza
  • 213
  • 1
  • 4
  • 14
11
votes
1 answer

How to enable autocomplete for Laravel Resources in PhpStorm?

Laravel 5.5 has a new API Resources feature, and it nicely redirects calls to model attributes (like $this->id). I use ide-helper:models to generate phpdocs for models that type-hints all model attributes. However, this does not apply to a resource…
Poma
  • 8,174
  • 18
  • 82
  • 144
11
votes
2 answers

Can authorize method in Request class return customized message for HandlesAuthorization trait?

I have the following code in Request class to check if the user is authorized to perform update. HandlesAuthorization trait, by default gives default message. Is there any way to return customized message? I saw the authorize method in Request…
Pankaj
  • 9,749
  • 32
  • 139
  • 283
11
votes
3 answers

Laravel 5.5 PHPunit Test - "A facade root has not been set."

When I do a try/catch on the DB::Connection()->getPdo();, I get the error A facade root has not been set. I believe it was happening with the Schema facades too before I tried adding the try/catch. The tests directory is, of course, outside of the…
Justin Anthony
  • 416
  • 1
  • 3
  • 13
10
votes
1 answer

How to downgrade in Laravel Framework? (5.6 to 5.5)

I have a project which is done with Laravel 5.6. But My current server doesn't have php 7.1 installed yet. How is it possible to downgrade to Laravel 5.5?
Mahesh Samudra
  • 1,039
  • 1
  • 11
  • 25
10
votes
4 answers

How to solve Exception It is unsafe to run Dusk in production in laravel 5.5?

I upgrated my project from laravel 5.4 to laravel 5.5 , I dont have any problem in local env but in server i get this exception , I searched a lot and i know this issue may be duplicated but no solutions solved my problem! How can i not registering…
Samira kalantari
  • 320
  • 1
  • 2
  • 16
10
votes
1 answer

Laravel Notification - Call to a member function routeNotificationFor() on string

Laravel 5.5 Controller public function sendBookingSms(){ $checkState = session()->get('checkState'); $staffs = Staff::whereIn('staffId',$checkState)->get(); foreach ($staffs as $staff) { $email = str_replace("…
Jishad
  • 2,876
  • 8
  • 33
  • 62
10
votes
4 answers

Laravel 5.5 validate with custom messages

I'm working on a pw change form in my laravel app. I want to use the validator with custom error messages. My code looks like this: $rules = [ 'username' => 'required|max:255', 'oldpassword' => 'required|max:255', 'newpassword' =>…
LakiGeri
  • 2,046
  • 6
  • 30
  • 56