Questions tagged [laravel-5.4]

Laravel 5.4 is a past version of the open-source PHP web framework replaced by 5.5 version created by Taylor Otwell. It was released on January 24, 2017. Use it in addition to the laravel-5 tag if your question is specific to Laravel 5.4. Use the laravel tag for general laravel related questions.

What is new:

  • Markdown Mail & Notifications
  • Laravel Dusk - BrowserKit testing replaced with ChromeDriver
  • Laravel Mix replaces Laravel Elixir
  • Blade Components & Slots
  • Implicit model binding for broadcast channels
  • Collection Higher Order Messages
  • Object Based Eloquent Events
  • Job Level Retry & Timeout
  • Request Sanitization Middleware
  • Realtime Facades
  • Custom Pivot Table Models
  • Improved Redis Cluster Support

Resources:

Other notable tags:

4188 questions
324
votes
4 answers

PHP7 : install ext-dom issue

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…
alex
  • 7,551
  • 13
  • 48
  • 80
323
votes
39 answers

Laravel Migration Error: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes

Migration error on Laravel 5.4 with php artisan make:auth [Illuminate\Database\QueryException] SQLSTATE[42000]: Syntax error or access violation: 1071…
abSiddique
  • 11,647
  • 3
  • 23
  • 30
87
votes
35 answers

404 Not Found, but route exist in Laravel 5.4

I'm using PhpStorm. I can run and open the index.php, but when I want to press submit button (post sign in), its display 404 not found. Web server Apache 2.4 running on Windows 10. This is my home This is my route
user5655563
72
votes
14 answers

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

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…
Y.EzzEldin
  • 801
  • 1
  • 8
  • 11
67
votes
27 answers

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

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…
Pred
  • 710
  • 1
  • 5
  • 10
61
votes
5 answers

Laravel Blade - Advantage of @slot/@component vs @include?

Laravel 5.4 Blade introduced the concept of components & slots - but I can't see what they add over the traditional @include. As I understand, with component/slots, you do: In template component-tpl.blade.php:
ChrisNY
  • 3,917
  • 4
  • 27
  • 31
48
votes
1 answer

Laravel 5.4 - Validation with Regex

Below is my rule for project name: $this->validate(request(), [ 'projectName' => 'required|regex:/(^([a-zA-z]+)(\d+)?$)/u', ]; I am trying to add the rule such that it must start with a letter from a-z or A-z and can end with numbers but most…
Black
  • 18,150
  • 39
  • 158
  • 271
47
votes
13 answers

Laravel 5.4 Disable Register Route

I am trying to disable the register route on my application which is running in Laravel 5.4. In my routes file, I have only the Auth::routes(); Is there any way to disable the register routes?
Dev.W
  • 2,340
  • 9
  • 38
  • 77
44
votes
7 answers

Laravel 5 - validate array as required, but allow an empty array to be passed

I'm validating a request in Laravel 5.4 with the validator, see the documentation: https://laravel.com/docs/5.4/validation#validating-arrays Basically, it's this code in the Controller: public function createSomeResource(Request $request) { …
Rafael Korbas
  • 2,213
  • 3
  • 19
  • 30
40
votes
3 answers

How to remove duplicates in collection?

I have collection in Laravel: Collection {#450 ▼ #items: array:2 [▼ 0 => Announcement {#533 ▶} 1 => Announcement {#553 ▶} ] } It is the same items. How ti delete one of them? Full code is: public function announcements() { …
Blablacar
  • 583
  • 1
  • 5
  • 16
39
votes
10 answers

Laravel 5.4 field doesn't have a default value

I am having this error and none of the googled result i checked is similar to my problem. I have an application with class Deal, User, and Matches A deal has many matches. A user has many matches. A user has many deals. I am attempting to create a…
John David
  • 752
  • 2
  • 9
  • 21
39
votes
3 answers

Laravel: orderBy a column with collections

I need to OrderBy a column with collection. I need to orderBy(updated_at, 'desc') all posts which owned by current logged user. Here is my code : $posts = auth()->user()->posts->sortByDesc('updated_at'); Here is User model : class User extends…
Hamed Kamrava
  • 12,359
  • 34
  • 87
  • 125
39
votes
12 answers

laravel 5.4 upload image

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) . '.' .…
Sawung Himawan
  • 441
  • 1
  • 4
  • 7
38
votes
12 answers

Including a css file in a blade template?

I want to include a css file in my Laravel blade template. I've tried: @include(public_path('css/styles.css')) But it says view does not exist. It does exist. How can I include a css file? Please note, I know this is not the correct way to link css…
panthro
  • 22,779
  • 66
  • 183
  • 324
38
votes
2 answers

Match JsonStructure in PhpUnit Test - Laravel 5.4

I am creating a unit test and want to test the JSON structure returned in the response. I am aware that the TestResponse provides a method assertJsonStructure to match the structure of your JSON response. But for some reason I am unable to map the…
Farooq Ahmed Khan
  • 3,975
  • 3
  • 27
  • 36
1
2 3
99 100