Nikush Patel has created a nice little site with PhpStorm tips presented as gifs. Really nice and helpful!

Go learn some tips

Adam Wathan has released a package for outputting SVG’s on your site. It looks nice and might become a standard include in my projects.

Go read more at the Laravel News post.

Laravel password reset caused double password hashing

I recently updated a little weekend project of mine to Laravel 5.2 and started using the re-implemented authentication stuff.
What I hadn’t implemented, or activated, on the site was password resets. Now password resets is sometimes a feature I myself sometimes use a lot, for different reasons and in this particular case I discovered a problem.

Now, when you have a register/login system on your website the passwords should be encrypted, hashed, and so on. How and when this is done is specific to you and your system, one smooth place to add it is on the setPassword method of your User model. This ensures that whenever the password is written to the database it hashed, right.
But here is where the “problem” arose when I activated the password-reset of Laravel (how have I not stumbled on this before?). So when you reset a password out-of-the-box, you get an email with a link -> go to reset page -> post new password -> password gets saved -> you are logged in. Nothing out of the ordinary.

But…
The password gets hashed in the ResetPasswords trait before it is saved, which is all good except if you hash it in the setPassword method. Because now it gets hashed twice and when you try to login you’ll get an error because the passwords will not match. Well luckily there is a simple fix.
In your PasswordController, inside App\Http\Controllers\Auth, add your custom resetPassword method which will override the traits one.

For example:

protected function resetPassword($user, $password)
{
    $user->password = $password;

    $user->save();

    Auth::login($user);
}

If you don’t do your hashing on the User models setPassword method your probably fine. Maybe doing it there is a weird place?
Let me know what you think.

All new heavy featured WordPress 4.4 released

”Don’t you mean feature heavy WordPress 4.4?”
No, actually I don’t. That is because I don’t think there are so many new features (i.e feature heavy) but the ones that came with 4.4 are pretty heavy 😉

Yeah, so WordPress 4.4 got released tonight (swedish time) and it come with som real nice features. The bigger ones are responsive images, embed everything and the long worked on WP-API is finally getting added to core. For now just the infrastructure has been added, but more is coming in upcoming releases. The embed everything means that you now easily can share posts on other WordPress sites with title, excerpt, featured image and can even get links for comments and sharing.

Enough from me, go read the official post on WordPress 4.4 “Clifford”.

OH! btw, this site here is already upgraded to 4.4!

PHP7 has arrived – Rejoice!

Now what does this all mean you ask?
Well if you haven’t heard or read much about PHP7 I can recommend these links to catch up.

PHP.net: Has the changelog and an migration guide.
SitePoint: Find out what’s new with PHP7
Laracasts: Up & running with PHP7

Socialite providers

Providers for Laravel Socialite

A few weeks ago a write an article on how to get started with Laravels Socialite (swedish).
If you are using Socialite you might feel it is a bit light, with just Facebook, Github, Twitter and so on. Fortunately there are awesome people making these kinds of packages just so much better and more useful.

Without further ado, I give you Socialite Providers by DraperStudios. Socialite Providers give you 70+, as of writing,  additional providers for Socialite.

Get started with Laravel 4

This first part is less about Laravel and more about Git and Composer. We will set up our local Laravel installation och push it to Github.

This post-series is written in Swedish and you can find it by clicking the link to the right –> [with the Swedish flag]


 

Update: Dec 2014

As this post get tweeeted out, I feelI should say that it is an old article (series) I started summer 2013, but never got finished.
I am planning on a new Laravel 5 series, also in swedish, during January. So come back soon 🙂

Laravel PHP Framework

coming up: A small Laravel tutorial

Yes, here we go. I am going to embark on my first ever tutorial (series) adventure, and it will be on the great Laravel PHP framework.
Now a few things I want to note: first of I have never done this before, so it will be a learning experience for myself. I’m hoping to get some of you interested in Laravel and at the same time deepen my own knowledge in the framework. Very egoistic right 😉

Second, it will be in swedish. Oooooh please don’t cry, there is a reason for it.
Even though most of this site will be in english, from time to time I will make some swedish elements. Reason being, there is so much stuff out there for you english speakers already. Swedish people are generally very good at english, but some do prefer to get their info in their “mother tongue”.

I’m working on the first, and second, part at the moment and it will hopefully be out this week, but the swedish midsummer holiday is on friday so will have to see. I might end up just barbecuing and having some beers.

STAY tuned…

custom post-types in WordPress 3.0 (swedish)

I wrote a small introduction and guide to creating custom post types in the upcoming WordPress 3.0.
If your swedish is somewhat okey, you can read the article over at my swedish blog or try the google translated version (the grammar sucks but hey).

You read about all the new stuff in WordPress 3.0 in the WP codex .