Category : Laravel



Laravel 5 Repository Pattern Tutorial from scratch

In this post i want to share with you how to create Repository Pattern in Laravel 5 application. generally we are getting data directly from model, I mean we are use just MVC. But if you have big application then it is better way if you use Repository Pattern. I will give you few step to create Repository Pattern. normally we use directly from Model but if you make Repository Pattern for every module then it is good way to develop laravel application. <img width="100%" style="border:2px solid red" src="/upload/Laravel-5-Repository-Pattern-Tutorial.png"> <strong class="step">Step 1: Create In.....

By Hardik Savani | April 13, 2016 | | 90522 Viewer | Category : Laravel
READ MORE

How to check if record exists or not in Laravel 5?

If you are new in laravel 5 and you want to determine email is exist or not then you can do it easily. IF you did use code php then we have to write long code and check but laravel provide it's own query builder so it is pretty easy. you can see following example how i check row is exists or not: <strong class="example">Example:</strong> <pre class="prettyprint lang-php"> $user = User::where('email',Input::get('email'))->first(); if (is_null($user)) { print_r("email is exists"); } print_r("email is not exists"); </pre>

By Hardik Savani | April 13, 2016 | | 22804 Viewer | Category : Laravel
READ MORE

How to check if View Exists or not in Laravel 5?

In some situations, we require to check if view exists then render view otherwise display something else. But you can perform this task using "exists" function of view helper. It will return true or false. So you can use bellow example. <strong class="example">Example:</strong> <pre class="prettyprint lang-php"> if (view()->exists('users.index')) { .... } </pre>

By Hardik Savani | April 12, 2016 | | 1682 Viewer | Category : Laravel
READ MORE

Laravel 5 Stripe example using Laravel Cashier from Scratch

In this tutorial post i show you the example of Stripe subscription example using Laravel Cashier in Laravel 5.1 application. In this example i use Laravel Cashier(Billing) of Laravel 5. Whenever you are work on big project like ecommerce or ERP on that project mostly we need to use subscription plane for your application that way client can earn something. So the laravel include Billing subscription using Stripe. we will make bellow example for pay subscription payment method. In bellow preview you can see i added 5 input field of form. one for select plane, second for add credit card number.....

By Hardik Savani | April 11, 2016 | | 93013 Viewer | Category : Laravel
READ MORE

How to get site URL in Laravel 5?

Here is quick post, which can help you to get base url or home page url of your laravel application. I think many times we need to get site URL for something share or link, so you can get that using url helper and URL facade. Both way are same you can use that anywhere i mean in controller or view. so let's see. <strong>Example:</strong> <pre class="prettyprint lang-php"> $url = URL::to("/"); print_r($url); <br/> $url2 = url('/'); print_r($url2); </pre>

By Hardik Savani | April 11, 2016 | | 13546 Viewer | Category : Laravel
READ MORE

How to get last executed query in Larave 5?

We have been many time need to get executed query log or you want to get last executed query or maybe if you want to diaplsy sql query from laravel query builder then you can do it that. so i have three example for display executed query in Laravel 5. when you are working on laravel application at that times , i think you need many time to print last run query or if you want to check direct from phpmyadmin sql box, so at that time you have to follow this three example. so, let's see three example of getting sql query from Laravel Query Builder. <strong class="step">Example 1:</strong> In this.....

By Hardik Savani | April 10, 2016 | | 22200 Viewer | Category : Laravel
READ MORE

How to get url segment in Laravel 5?

Whenever you need to get current url segment then you can get using Request facade. I give you example one for using Request facade. so you can get segment from url and how you can see both example. <strong>Example:</strong> <pre class="prettyprint lang-php"> @extends('layouts.app') @section('content') {{ Request::segment(1) }} @endsection </pre>

By Hardik Savani | April 10, 2016 | | 7699 Viewer | Category : Laravel
READ MORE

How to get current route name in Laravel 5?

Whenever you need to get current route name then you can get using Request or Route facade. I give you two example one for using Route facade and another for Request facade. so you can get route name both way and how you can see both example. <strong>Using Request:</strong> <pre class="prettyprint lang-php"> $routeName = Request::route()->getName()); print($routeName); </pre> <strong>Using Route:</strong> <pre class="prettyprint lang-php"> $routeName = Route::getCurrentRoute()->getPath(); print($routeName); </pre>

By Hardik Savani | April 10, 2016 | | 9583 Viewer | Category : Laravel
READ MORE

Laravel 5 Localization(trans helper) tutorial example

First Laravel 5 introduce localization for laravel application. Localization is very pretty intrsting topic added on laravel 5. Localization through we can manage multiple language message. i mean you can manage multiple languages within your application. for example you have one title like "Home Page", this is static title and now it is in english, but you also manage other language like if this site open in spanish then name will like : "Página de inicio". <img width="100%" src="/upload/Laravel-Localization-Tutorial.png" alt="Laravel-Localization-Tutorial.png" style="border:2px solid red".....

By Hardik Savani | April 9, 2016 | | 19242 Viewer | Category : Laravel
READ MORE

Laravel 5 - Class 'Input' not found issue?

When i start to work on Laravel 5.2 at that time i fetch this problem "Class 'Input' not found". When i copy my old controller code from laravel 5.1 version that time i found this issue, but i also could use Input insted to Request but i want to use Input as it is. But at last found solution. you have to just use following aliase on your controller. <pre> use Illuminate\Support\Facades\Input as Input </pre>

By Hardik Savani | April 8, 2016 | | 5524 Viewer | Category : Laravel
READ MORE

    PHP - How to create zip file and download using ZipArchive ?

    PHP - How to create zip file and download using ZipArchive ?

    Open Post

    Jquery - How to copy text to clipboard without flash example ?

    Jquery - How to copy text to clipboard without flash example ?

    Open Post

    Laravel 5.3 - whereDate(), whereMonth(), whereDay() and whereYear() examples.

    Laravel 5.3 - whereDate(), whereMonth(), whereDay() and whereYear() examples.

    Open Post

    PHP - Getting Started PHPUnit test with simple example

    PHP - Getting Started PHPUnit test with simple example

    Open Post

    Laravel 5.4 New Feature - Add new Components & Slots in Blade Template

    Laravel 5.4 New Feature - Add new Components & Slots in Blade Template

    Open Post

    Laravel 5 amazon s3 file upload tutorial - Part 1

    Laravel 5 amazon s3 file upload tutorial - Part 1

    Open Post