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
36
votes
5 answers

Laravel relationships attach if not already attached

Is there a quick way of attaching relationships if they're not already attached. I am using this code to update relations of a model; if (!empty($request->get('roles')) && is_array($request->get('roles'))) { …
user5500750
33
votes
1 answer

Pluck with Where condition

I can take the list using $specialities = Speciality::pluck('name','id') Why isn't the following code working? What could be an alternative? I am returning this array by ajax to form a select box. So I thought pluck (list in laravel 4+) would be…
siddiq
  • 1,693
  • 3
  • 17
  • 44
32
votes
3 answers

Laravel middleware with multiple roles

I've been running into some issues with Laravel's middleware. Let me tell you the basic idea of what I'm trying to accomplish: Registered users on the site will have one of four roles: Student (default): can access 'index' and 'show'…
Jesse
  • 373
  • 1
  • 4
  • 10
30
votes
9 answers

Method validate does not exist - Laravel 5.4

I have a very weird problem. When I'm submitting the form, it throws an error with server-side validation. Here is my simple controller: namespace App\Http\Controllers; use Newsletter; use Illuminate\Http\Request; class SubscriptionController…
Parth Vora
  • 4,073
  • 7
  • 36
  • 59
30
votes
7 answers

PHPunit Uncaught Error: Call to undefined method PHPUnit_Util_Configuration::getTestdoxGroupConfiguration()

i don't know if it's related to Laravel 5.4. when i run phpunit command after installing laravel 5.4 without making any changes i get Uncaught Error: Call to undefined method PHPUnit_Util_Configuration::getTestdoxGroupConfiguration() but when i run…
ishadif
  • 721
  • 2
  • 8
  • 20
29
votes
1 answer

Laravel : Many to many insertion

I have two models, User and Team The relationship between them is ManyToMany: In User: public function teamMembers(){ return $this->belongsToMany('App\Team')->withPivot('id');; } And in Team : public function teamMembers(){ return…
Gammer
  • 5,453
  • 20
  • 78
  • 121
29
votes
5 answers

`npm run watch` not working in Laravel 5.4

Using Laravel 5.4 and Mix, when I run npm run watch it compiles everything once and looks like it is waiting for changes, but when I make changes to any of my asset files it doesn't seem to detect anything. Is anyone else having this issue in 5.4 or…
Josh Mountain
  • 1,888
  • 10
  • 34
  • 51
28
votes
8 answers

Laravel 5.4^ - How to customize notification email layout?

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…
Brian Glaz
  • 15,468
  • 4
  • 37
  • 55
27
votes
3 answers

Laravel 5.4 - Override API 'throttle:60,1'

I'm writing a lot of API to get and store data. I like the default throttle option: protected $middlewareGroups = [ 'api' => [ 'throttle:60,1', 'bindings', ], ]; to limit the request to 60 per minute; but for some route (es:…
vlauciani
  • 1,010
  • 2
  • 13
  • 27
27
votes
6 answers

Laravel: validate json object

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":…
MTA
  • 1,033
  • 5
  • 16
  • 37
27
votes
17 answers

Laravel yield attribute

I'm trying to set an attribute using @yield and @section, but how? I tried to use and @section('mainApp','id="myid"') but it returns id="myid" instead of id="myid" I know that I can manage it with a default id…
Vixed
  • 3,429
  • 5
  • 37
  • 68
25
votes
8 answers

multiple prefix with the same route group

im writing a fairly simple website for a school ... this website has news , articles , video clips ... etc the way it works is in the home page we present visitor with some lessons like >math >geography >chemistry user selects 1 on these and…
hretic
  • 999
  • 9
  • 36
  • 78
25
votes
5 answers

Laravel Public url for storage files

I want to retrieve public url for all the files stored using storage::putFile('public/spares'); So, this is the issue I'm using storage::files('public/spares'); but it provides this output from laravel storage…
Daniel Euchar
  • 1,740
  • 5
  • 28
  • 45
25
votes
3 answers

Laravel Task Scheduling Every X Hours

I undestand that you can create hourly tasks on Laravel by using: $schedule->command('catalog:update')->hourly(); however is there a way to do for example every 2 hours or 5 hours? I couldn't find it on documentation or here.
senty
  • 12,385
  • 28
  • 130
  • 260
25
votes
9 answers

Allow login using username or email in Laravel 5.4

Now I've followed the Laravel documentation on how to allow usernames during authentication, but it takes away the ability to use the email. I want to allow users to use their username or email to login. How do I go about this? I've added this code…
Paul Lucero
  • 547
  • 4
  • 8
  • 15