Laravel; Auth::attempt() works but user not logged in.
May 8th 2014This was a funky problem that took me a while to figure out.
When a user was logging in, the Auth::attempt()
was returning true if there were good credentials passed. However! Using Auth::check()
or any other Auth method showed the user wasn't actually logged in. What the heck?
After much hunting, I found this answer on Stack Overflow.
The problem is you have used "userId" as your primary id - but you have not told Laravel.
I realized I did NOT use id as the id
for the users table, I went with uid
because I thought it made more sense. That's fine, but then you need to tell your Users model what the primary key is by adding this line.
protected $primaryKey = "[your-primary-key-here]";
If you were searching and having this issue, I hope it helped!
Fun fact: increasing the font size of Sublime Text 2 has greatly helped my ability to focus. Apparently trying to work w/font size of 11 isn't possible anymore with my eyes. Changed to 18 point and it is wonderful.
Laravel; having a conditional choose your @extends template
Mar 18th 2014I am firmly entrenched in the Laravel camp now. One thing I love about Laravel is their blade templating language. However, there is some quirkiness that isn't immediately obvious.
Let's say you have a template that is extending another template. You want a conditional to determine which template you want to extend. (The use case here for me is a messaging system. Logic + layout is the same on back-end and front-end, but they extend different templates).
I was trying to get this to work:
@if($var)
@extends('account.base')
@else
@extends('base.base')
@endif
@section('content')
<h1>Here are things!</h1>
@stop
All it was doing was outputting the one @extends('base.base') line. After much hunting, I found this great answer on StackOverflow. So, @extends() must be on the first line of a blade template, which is a little weird, but whatever. Used ternary operator like this and it works!
@extends($var ? 'account.base' : 'base.base')
It's not the people you miss, it's the moment.
Jan 20th 2014It's not the people you miss, it's what you felt during those moments. And those feelings can't really be felt again. It was for a younger you. Focus on where you are now, don't try to recreate the past.
Time for Reflection
Jan 16th 2014My family just got back from our first vacation in over three years. After us getting married and having two wonderful children it was definitely overdue.
I have had a lot of small revelations about things that I am still processing. As I iron out the details I will be sharing them. Expect posts aplenty!
Just finished the todo list for the next four days, after which we launch a new project that is running on Station, the new CMS package for Laravel we developed. It's going to be intense, and worth it!
I found this great PHP input validation class called GUMP. It is only ~32Kb, one file. Looks perfect to integrate with Fat Free Framework.
Test status update from my phone.
title one
Nov 25th 2013I've been wearing my sysadmin hat all morning and I like it. Love spinning up and customizing new instances.
Crazy amounts of new knowledge
Sep 26th 2013A couple days ago I passed my 5 month mark at my new job as a Senior Developer at the Canary Collective. It's been really great working with some super talented people like Ben, Blake and Todd. But also, holy crap the new stuff I've been learning!
- Fat-Free PHP Framework
- Ion Auth CI authentication library
- Tank Auth CI authentication library
- PayPal API, payments and subscriptions
- Authorize.net payment system
- INK filepicker API
- Cycle2 jQuery slideshow plugin
- Insane levels of front-end js magic
There are more I just can't think of them at the moment. Point is, getting to learn a lot which is awesome. Also, dealing with a lot more front-end work that I was used to. It is pushing me out of my comfort-bubble which is a good thing.