Working with workbench and building packages in Laravel 4

I come from the world of Drupal where every code that we write is part of a module. This is very useful because over time I am able to develop modules which I can re-use in all of my projects. Codeigniter has this feature using HMVC which I showed in the tutorial HMVS architecture with Codeigniter. The same approach can be followed in Laravel 4 using workbench to create packages. This way we can make independent piece of code (or some dependent on other modules) and once we plug it in, the module is ready to do what it is supposed to do. In this tutorial I will start with a blog module which will be independent; it will have its own migrations, controllers, models, views and its own routes.

Tags:

Laravel 4 Swift Mailer with dynamic config instead of mail.php to send mail through Gmail

Laravel 4 comes with the Swift Mailer library which works great in sending emails from your application. Just set the mail.php configuration file with the required variables and you are good to send emails. Inline images, attachment are like one line code. But the problem with a config file is that the parameters are fixed. I had a requirement where user would send email using their Gmail username and password. So, in this tutorial I will show you how to create a Swift Mailer instance and send a mail with a dynamic username, password and other parameters.

Tags:

Laravel 4 forms, retain data, default and custom validations

Working with forms in Laravel 4 is real fun and there is hardly any PHP application which doesn’t have a form. So, in this tutorial I will demonstrate how to create a simple registration form using the Laravel’s form library. Then we will validate the data when the form is submitted. We will use the validation library which comes with Laravel 4 out of the box and also our custom validation rule.

Tags:

Getting started with Grunt JS

Grunt JS is one tool which any developer can very quickly get addicted to and there are a hell lot of tasks which we can automate with Grunt and save a lot of in our workflow. In this tutorial I will create the package.json file which is required by Grunt, install a few packages and then use them in our workflow.

Laravel 4 Multiple segment route and Blog post page

In this tutorial I will show how we would define a route with multiple segment in Laravel 4 so that we can use the URL alias of a Drupal node and then take the user to the individual node's page. Also, we will see how we can override a view section's content to set the page title to the blog's title inside the head tag.

Tags:

Laravel 4, Angular and Blade template with double brackets

Adding Angular JS into Laravel is no big deal. It's as simple as adding a script tag with source inside a page. But the problem comes when your Laravel 4 view uses the double brackets "{{ }}" because Angular and Blade both uses the same character to understand that there's a variable inside it. So here is how we need to deal with it.

Laravel 4 Debug bar and Caching

Caching of data is very important for any application and if we can save SQL queries, then it is always a bonus. In my last tutorial, I created the node object which was fetching its data from multiple tables and in different queries. In this tutorial I will cache the node object and save the SQL queries.

Tags:

Laravel 4 Eloquent and a Drupal 7 database

In this tutorial, I will be using Laravel 4 framework and its query builder to communicate with a Drupal 7 site's database. I will create a node model which is build the basic node and then a blog node which will extend the node model and create the blog object.

Tags: