Laravel 4

Laravel 4 tips, tricks, and secrets.
  • How to create configurable/bundle/grouped downloadable product in magento?

    To do this you have to set "links purchased separately" to "no" in the backend option for "Downloadable product".

    When creating a new downloadable product under the downloadable options tab you will see a selection for downloadable links to "no" as seen in screen shot.

    As soon as you do this, you will be able to see "Downloadable products" in the association list of "Configurable/grouped/bundle" products.

    Then create your bundle/grouped products like you would with simple products.

    downloadable_links2 2

  • Renaming Database Tables Using Laravel 4's Schema Builder

    If you're like us and have been playing around with the Laravel 4 beta, you've probably been enjoying the database migrations and other utilities that come with it out of the box. For us, as we've been building Quillio - our upcoming service built on Laravel 4 - the database migrations and schema builder have been instrumental in keeping our local and beta development environments in sync, and then again when we're ready to go to production. And if you're like us and constantly refine and improve your application, you've probably had to rename a database table or two during development. Unfortunately, on the surface it doesn't look like Laravel 4's schema builder has an easy way to do this - but looks can often be deceiving. I've been diving into Laravel 4's core files more and more lately to get a better understanding of what it can do, especially since the documentation is still in flux and being fleshed out. It was while I was poking around these files one day that I discovered the schema builder does, in fact, have a method to rename database tables for you, making it nice and easy to call this from within your database migrations and helping you avoid writing raw SQL, which isn't very portable from driver to driver and I personally always have to look up the syntax. So how exactly do you rename a table using Laravel 4's schema builder?

    Schema::rename($from, $to);
    That's it! It really couldn't be simpler. Just call Schema::rename() and pass in the original table name and the new one you'd like to rename it to. Here's an example of how this might look in a migration where we want to rename table 'foo' to 'bar':
    <?php
    
    use IlluminateDatabaseMigrationsMigration;
    
    class RenameFooTable extends Migration {
    
    	/**
    	 * Run the migrations.
    	 *
    	 * @return void
    	 */
    	public function up()
    	{
    		Schema::rename('foo', 'bar');
    	}
    
    	/**
    	 * Reverse the migrations.
    	 *
    	 * @return void
    	 */
    	public function down()
    	{
    		Schema::rename('bar', 'foo');
    	}
    
    }
    Sometimes you just have to get your hands dirty and dive into the source code a bit and you'll uncover some simple, but incredibly useful, gems like this one. I hope this quick tip helps keep your development quick and migrations clean! We'll post more hidden features like this as we uncover them, so stay tuned!

2 Item(s)