We always required to get count of number of records or number of inserted record of current month etc in laravel. We can use mysql count function in laravel eloquent. We have two way to get count of column value. first we can use laravel count() of query builder and another one we can use with directly with select statement using DB::raw(). I give you both example you can see and use any one as perfect for you.
<pre class="prettyprint lang-php">
$data = DB::table("click")->count();
<pre class="prettyprint lang-php.....
If you think how can i create custom error page like 403, 404, 405, 408, 500, 502, 504 on my laravel application then you can make easily and implement it very easily. You can set custom error page globally in laravel project. if you want to create 404 your custom design error page then you can do it easily.
<img width="100%" src="/upload/laravel-5-Custom-Error-Page.png" style="border:2px solid red">
In this post i am going to show you how to create custom layout for error page, if you think i want to display 404 page layout difference, 505 error page layout difference, 500 error page layout.....
Laravel framework is awesome framework in todays. Laravel provide sevaral good feature and that's why it is very popular framework in PHP. Basically if we are work on big website project or ERP level project we always need to define some global variable like site title, number of pagination, footer text etc as depend on our project. So, I am going to show you how to define and use global variable in Laravel 5. Laravel 5 provide very simple way to set Global Variables in our laravel application. It is very pretty simple and with good directory structure.
First we have to create global.php file.....
I would like to explain how to create custom helper functions, in your laravel project some functions and some repeating code, so at that time you have to create some helper functions that can help to easy way and every time you not need to write more code and very flexible, that way you can easily modify that code.
Now if you want to add custom helper functions in your website or project directoty then you have to follow just three step and use it.
<strong>Step 1: Create helpers.php File</strong>
In this step, you need to create <strong style="color:red">app/Http/helpers.php</strong> in you.....
Today, I am going to share with you How to prevent back button after logout in PHP Laravel framework. If you observe deeply then you found this fault, When user logout after if user hitting back button from browser then it will goes on home page or existing page that he was before login. But it should redirect on Login page instead of homepage or other existing page.
But we can prevent this issue by using Laravel middleware. We will create one middleware and prevent back button history. So we have to create new middleware and use that middleware in our route.
So, I am going to do from scratc.....
We always want to see auto load more data on page scroll on your home page or other pages for posts, news, listing etc like on facebook, twitter, linkedin etc. If you implemented infinite scroll on your php application then you don't require to give pagination and also not require to page refresh every time when page scroll.
So, Today, i going to give you simple example of infinite scroll using jquery ajax on page scroll in laravel application from scratch. I use jquery scroll event for page scroll. this example is pretty simple, you can customize simply for your development.
You have to jus.....
If you are working on laravel and you want to do like: How to redirect back to previous url, After login. after login user you can redirect his previous page as he was before. you can do this, i would like to give you two example. first example is using intended() and second one is using session but i don't know more but i think intended() is not working proper in laravel 5 but you can try in laravel 4. but i am sure i gave you example with session that work well in both.
So, you can try any one and get your solution, 1. using intended() and 2. session.
If you want to get Query string value then you can get using Request Facade OR Input Facade in larave 5. But if you was working native PHP then we can get $_GET method. In following example you can easily get parameter value.
<strong class="example">URL Example:</strong>
In above query string, you want to get query string value for example id and name. you can get through bellow example.
<strong class="example">Route Example:</strong>
<strong class="example">Controller Example:</strong>
In this post you can learn how to add multiple condition in join query of Laravel Eloquent. if you use data relationship then you don't need to use but if you need to get manually join with two or more condition then it can help. in this example i also add how to add simple inner join in laravel and how to add multiple conditions with inner join i mean using "on" method. You can see bellow example:
<pre class="prettyprint lang-php">
$user = User::select("users.*","items.id as itemId","jobs.id as jobId")
Today, i going to give you example of how to add geochart in your laravel 5 application using lavacharts package. Normally we used geochart on back-end for check users country wise with graphical way. In this post we will implement geo chart with country and it's total users. lavacharts advantage is you can manage all data with chart matadata from controller, you just render on view.
lavacharts provide several other charts like bar chart, Area chart, Column Chart, Pie Chart, Line Chart etc. In this post we will use geo chart with good graphical way. you can use in your laravel application, y.....