Book Image

Learning Laravel 4 Application Development

By : Hardik Dangar
Book Image

Learning Laravel 4 Application Development

By: Hardik Dangar

Overview of this book

<p>Laravel 4 is a clean and classy framework for PHP web development. It attempts to ease the development of web applications by simplifying the common tasks required in the majority of web projects, such as authentication, routing, sessions, and caching.</p> <p>"Learning Laravel 4 Application Development" uses a step-by-step approach to teach you how to build real-world web applications. You will learn how to create a web application from scratch as well as how to create and use packages to build reusable components to be used in your projects.</p> <p>This book begins by familiarizing you with MVC concepts as well as the Laravel 4 framework. From there, it moves on to the creation of the frontend and backend of your web application. As you progress through the book, you will learn how you can authenticate users as well as develop RESTful APIs. You will also learn how to configure, optimize, and secure your applications. Lastly, it teaches you how to deploy your applications using different approaches like Git, FTP, and SSH.</p> <p>Laravel 4 Application Development will teach you everything you need to know to create accessible real-world web applications quickly and efficiently.</p>
Table of Contents (18 chapters)
Learning Laravel 4 Application Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
4
Building a Real-life Application with Laravel 4 – The Foldagram
11
Creating a Workflow and Useful Laravel Packages and Tools
Index

Managing Foldagram pricing


The next functionality we need to build for the administrator is to manage the pricing per Foldagram based on range. Jordan wants to give discounts to users who buy credits (buy credits and prepay for Foldagram). Say if you are buying seven credits, you will pay less as the Foldagram price will depend on the range as follows:

  • 1 to 4 Foldagrams: 4 USD/Foldagram or per credit

  • 5 to 10 Foldagrams: 3.5 USD/Foldagram or per credit

  • 11 to 20 Foldagrams: 3 USD/Foldagram or per credit

We will need to build an interface that will allow our admin to add price and also manage pricing. Let's start building an interface for to add pricing.

Adding pricing

As you can see, the interface is quite simple; we just need to ask admin about the "from" quantity and the "to" quantity and the price for that range. Here is the Controller and View file for generating the form:

    public function getadd()
    {
        
        return View::make('admin.add_credit')->with('title','Foldagram - Admin...