Laravel: Validating in the model written by Simon Stevens and updated on 18 October, 2013

Being more used to Lemonstand's "validation in the model" approach I found that I'd have to come up with my own solution when working with Laravel.

It relies on storing a rules array in the model, and then hooking in to the saving event to process those rules.

Event::listen('eloquent.saving: *', function(Eloquent $model){

$v = Validator::make($model->attributesToArray(), $model->rules);

throw new Exception(implode("\r\n", $v->messages()->all()));

If you use it, let us know @3dpixelnet

Barclaycard Paytag written by Alan Ogden on 17 May, 2013

The future... or not.

Today, I paid for a sandwich with my Barclaycard Paytag or Contactless Payments as it's generally known. 

For those not in the know, this is the NFC 'credit card attached' enabled tag which allows purchases of up to £20 with a single swipe of the card. It's designed to forego the necessity of chip-and-pin in our fast paced busy lives. This is designed to be stuck to the back of a mobile phone.

Great! I hear you cry, however this got me thinking.

1. There is literally no security. The self-checkout presented the bill to me and I swiped my card. Quick £10 gone. There wasn't any kind of security check on the phone of any kind. If I knew your tag was attached to your phone in your pocket, could I, with a terminal presenting a 'bill' casually rub up against you in a busy shopping area and it takes £20?

2. People lose, or have their phone stolen more often than they do their wallets or purses. Your phone is always on show and not secure. Coupled with this, if you look at the featured image, it's not exactly subtle is it? I mean, you've effectively got a smaller bendier credit card sellotaped to the back of your phone, totally in contrast to the phone itself. You wouldn't walk around with your credit card in your hand all day so why is this any better?

3. Every time you upgrade your phone (and I do this a lot), it would require a new Paytag. If I somehow manage to rip this thing off it's not going to be in any state to stick to another phone. 


Ways this can be improved...

1. Most modern phones (cough, not iphone yet) have NFC built in. Use an app to control it so we can have some kind of security. e.g. bill presented, swipe card, phone prompts 'do you want to pay £x to Widgets Ltd' and you click OK. Naturally, the app would ensure that you have SOME kind of protection on the phone itself... pin number, face recognition, pattern etc.

2. More of a general bugbear this than specifically paytag related. EMAIL ME MY RECEIPT rather than throwing some paper at me. It's 2013!

As things go, it's not going to work. It needs to be more secure, less obvious and garish. It's being touted for phones however it does not require a phone. I may aswell have sellotaped it to the back of my hand.

Are you wasting time redesigning when you should be overhauling? written by Simon Stevens and updated on 17 September, 2013

When we starting our much needed and long overdue website redesign we experimented with mockups internally.  We even went so far as to fully code 1 new design before we decided that it wasn't what we were looking for.

Eventually we commissioned Top Left Design who provided us with the basis (we can't help but tweak and tinker!) of what you see now.  Unfortunately however, we overlooked the obvious:

Our content and products were dated and not suited to the current market.

Read more

Creating a Blog Search Page for Lemonstand written by Simon Stevens on 11 September, 2012

Credit: 96dpiThe default Lemonstand page setup doesn't come with blog pages at all (bizarre I know), however they very helpfully provide documentation which is enough for most people.

One of the missing features though, is a search page!  Oh noes!

It's very easily added though, steps below :)

  1. Duplicate your main Blog Archive page.
  2. Rename it to Blog Search, update the url as you like.
  3. Add the following code at the start of the page:
    You searched for "<?= h(Phpr::$request->getField('search')) ?>"
  4. Add the following code in the Post Action Code section of the Action tab:
    if($search = Phpr::$request->getField('search')){
    	$search = '%' . $search . '%';
    		"title LIKE :search OR 
    		description LIKE :search OR 
    		content LIKE :search", 
    		array('search' => $search)
  5. .....
  6. Profit!

Now just create a search form that submits to your Blog Search page using a GET method and search variable "search".

Be the first to comment!