Read the latest updates for Full Stack Stanley.
Laravel Laravel 4 ElasticSearch PHP Search
Simple Search with Laravel and ElasticSearch
I was recently asked to make a search engine for a client's website. Normally I would go down the MySQL fulltext search route but I was feeling rather adventurous at the time. I had no experience with ElasticSearch, Apache Solr or any other search system prior to this so I decided to pick ElasticSearch and dive in head first. This tutorial is a result of some of the things I picked up while learning it. I aim to show you how to set up the Elasticquent Laravel package and some basic ways to fine tune your search engine.
Laravel 4 Laravel PHP Eloquent
Laravel 4.1 one-to-one polymorphic relationships
To use one-to-one polymorphic relationships in Laravel 4.1 use the "morphOne" method in your models. For example: I have two tables, pages and products. I want to be able to add one featured image to each of these. The Product model would look like this: <?php class Product extends Eloquent { public function image() { return $this->morphOne('FeaturedImage', 'imageable'); } } The Page model would be: <?php class Page extends Eloquent { public function image() { return $this->morphOne('FeaturedImage', 'imageable'); } }
Middleman Bootstrap SASS Static Site Generators
Middleman Template: bootstrap3, SASS and Slim
As quoted from their website, Middleman is "A static site generator using all the shortcuts and tools in modern web development". I really love using Middleman for simple static websites. Everything I use in my front end stack (SASS and coffeescript) just works out of the box. Using two commands middleman while developing a website locally and then middleman build when I'm ready to push the static content to my server. It really saves a lot of time.