Skip to content

Mastering PHP and Laravel

Never stop learning!

Menu

  • Home
  • Blog Posts

Laravel

The current state of things

It’s amazing how life gets going in a rhythm, and you get your head down and working so hard, that you sometimes forget to look around (or in this case, write in your blog). Working at a small travel advertising

Kenny March 26, 2020January 21, 2023 Blog Posts, Javascript, Laravel, Learning, PHP, Programming No Comments Read more

Defensive Programming | Laravel find()

Defensive Programming One of the things I’ve learned in my career is to code defensively. Laravel makes it very easy to ask for an object, but it also makes it very easy to get it wrong. If you request an

Kenny February 5, 2019January 21, 2023 Blog Posts, Eloquent, Laravel, PHP No Comments Read more

Laravel – the difference between all() and get()

When dealing with a model, all()  is a static method. It creates a new query object, and runs get()  on that object get()  is not static, but can be called statically because of a magic method in the Model class.

Kenny October 12, 2018January 21, 2023 Blog Posts, Eloquent, Laravel, Learning, Programming No Comments Read more

Laravel Eloquent only()

$fullModel = Model::find(1) // Get model with id 1 $idArray = $fullModel->only(‘id’) // array containing id // this does not work. You’ll get back an empty collection // It is trying to pull the id column off the collection object,

Kenny October 12, 2018January 21, 2023 Blog Posts, Eloquent, Laravel, Learning, Programming No Comments Read more

Laravel Eloquent Attributes

When dealing with an Eloquent model, you can add your own attributes. These can be useful for computed values. For example: class Person extends Model { // By default, all the database fields will be available. // Let’s assume for

Kenny October 9, 2018January 21, 2023 Blog Posts, Laravel, Learning, PHP, Programming No Comments Read more

Laravel Eloquent sortBy function

Here is how you can sort a collection by an ordered array of ids. The use case here was that I had a number of objects in a Redis cache, which were retrieved in unsorted order. The objects were large,

Kenny October 9, 2018January 21, 2023 Blog Posts, Laravel, PHP, Programming No Comments Read more

Making progress in Laravel

I’m making good progress in learning Laravel. I just wrote a service provider, and then created a Facade for it. The concepts are coming together nicely. Here are a few of the pages I used to help figure this out: https://laravel.com/docs/5.2/providers#registering-providers

Kenny March 29, 2016January 21, 2023 Blog Posts, Laravel, Learning, PHP, Programming No Comments Read more

Laracast: Laravel 5 Fundamentals

Today I’m starting the Laracast “Laravel 5 Fundamentals”. Let’s see how long it takes me to complete it…

Kenny February 11, 2016January 21, 2023 Blog Posts, Laravel, Programming No Comments Read more

Installing Laravel site: permissions

If you get this error Error in exception handler. when trying to hit the root of a new install, do these two things on OSX:   sudo chown -R _www app/storage (replace _www with your Apache server name if necessary)

Kenny October 27, 2014January 21, 2023 Blog Posts, Laravel, PHP No Comments Read more

Archives

Categories

  • Blog Posts (90)
  • iPhone (2)
  • Learning (42)
  • Linux (4)
    • Debian (1)
  • Mac Terminal / Linux (6)
  • Other Stuff (1)
  • Programming (68)
    • .NET (1)
      • C# (1)
    • Java (1)
    • Javascript (6)
      • AngularJS (1)
      • Node.js (2)
    • MySQL (3)
    • Objective C (1)
    • PHP (45)
      • Community (5)
      • Laravel (9)
        • Eloquent (3)
    • SQL (7)
    • Tools (2)
      • PHP Storm (1)
  • Slim Framework (1)
  • Uncategorized (9)
  • WordPress (3)
Copyright © 2023 Mastering PHP and Laravel. All rights reserved. Theme Spacious by ThemeGrill. Powered by: WordPress.