Category : PHP



Laravel 5 Join with subquery in Query Builder Example

In this post i want to show you how to use subquery with join in laravel query builder. Whenever you need to use subquery in your laravel project you can use following example and learn hot to use subquery. In bellow example you can see we add subquery using DB::raw(), DB::raw() throught we can select our subtable and after in second argument i added compare your field. That way you can easily fire subquery with laravel 5.2 query builder. <strong>Example:</strong> <pre class="language-sql"> $data = DB::table("items") ->select("items.*","items_count.price_group","items_count.quantity_group") .....

By Hardik Savani | March 2, 2016 | | 40289 Viewer | Category : PHP
READ MORE

How to fetch this week records in MySql ?

If you require to get all the records of current week using mysql query. for example you have one table "items" and columns are id, title, description, created_at and update_at, Now you want to get all records of this week. so you can fetch fields value using DATE_SUB and INTERVAL of mysql. In following example you can see how to select data of current week. <strong>Example</strong> <pre class="language-mysql">SELECT * FROM items WHERE created_at > DATE_SUB(NOW(), INTERVAL 1 WEEK);</pre>

By Hardik Savani | February 28, 2016 | | 4300 Viewer | Category : PHP
READ MORE

How to remove empty values from array in PHP?

you have array with empty value and you want to remove all empty value from that array without loop. you can remove your all empty value from array without loop. PHP array_filter function through you can remove all empty value, you can do both way try and see following example how to do this : <strong>Example:</strong> <pre class="language-php"> $example = array(100, "hari", "","hey", "", 77, "hello"); $result = array_filter($example, function($value) { return !empty($value); }); print_r($result); <br/> $resultDirect = array_filter($example); print_r($resultDirect); </pre> <strong>Out.....

By Hardik Savani | February 28, 2016 | | 5017 Viewer | Category : PHP
READ MORE

How to get ckeditor value with tags on ajax-submit ?

If you are use ckeditor for textarea and you need to fore ajax submit or form js submit, but you can't find ckeditor value in your controller or php file. So, first you have to update field using CKEDITOR.instances. so you can try to following code. <pre class="language-javascript"> for ( instance in CKEDITOR.instances ) CKEDITOR.instances[instance].updateElement(); </pre>

By Hardik Savani | February 26, 2016 | | 2138 Viewer | Category : PHP
READ MORE

Codeigniter Angularjs http post not working

Sometimes, you face problem you can't get post data using $this->input->post(), when you fire $http.post() using AngularJS or Jquery. I also face this issue, i can't receive post value when i fire $http.post in AngularJS, But i found how to receive post data or json data in Codeigniter controller. in following example through you can solve your problem: <pre class="language-php"> public function store() { $this->load->database(); $_POST = json_decode(file_get_contents('php://input'), true); $posts = $this->input->post(); $this->db->insert('posts', $posts); } </pre>

By Hardik Savani | February 22, 2016 | | 2891 Viewer | Category : PHP
READ MORE

Codeigniter 3 and AngularJS CRUD with Search and Pagination Example.

In This tutorial i want to show you how to create CRUD(Create, Read, Update, Delete) using AngularJS in Codeigniter. I added few step to create create, edit, delete, lists, search and pagination application in your Codeigniter framework. In this tutorial through you can make simple crud, search and pagination module and easily use in your codeigniter project. I am going to show preview of items module that we will do using angularJS and Codeigniter 3. <strong>Preview:</strong> <img src="/upload/code-angular.png" width="100%" style="border:2px solid cadetblue" /> <strong class="step">Step 1: C.....

By Hardik Savani | February 21, 2016 | | 206780 Viewer | Category : PHP
READ MORE

How to convert one time zone to anothor time zone

Some application required one time zone to convert another time zone. PHP provide some readymade timezone conversion classes but it a very complecated. so we have try to define this function simple way. You can createe a simple class and write one function into the class. then you able to use this function everywere. <pre class="language-php"> class convertTimezone { function convert_timezone() // Constructor of the class { } function converToTime($conv_fr_zon=0,$conv_fr_time="",$conv_to_zon=0) { //echo $conv_fr_zon; $cd = strtotime($conv_fr_t.....

By Hardik Savani | February 17, 2016 | | 1028 Viewer | Category : PHP
READ MORE

Crop, Resize, Frames etc on selected image in php using Aviary

Whenever you require to use any image plugin for select image and crop,resize,effects,frames,strickers ect, so you have to use Aviary api like as you see of facebook, twitter ect., that site plugin provide lots of efects and api guide that way you can use easily in your web app and as well as on mobile app too. So, I am going to give demo of how to use this api in our side. <strong>Preview:</strong> <img style="border:2px solid cadetblue;width:100%" src="/upload/selectimage.png"> <strong>Example</strong> <pre class="code language-html"> <html> <head> <title>Aviary Image U.....

By Hardik Savani | February 16, 2016 | | 5238 Viewer | Category : PHP
READ MORE

laravel 5 change date format using carbon example

Sometimes you require to change date format in your laravel app. we have to use Carbon class for change format in laravel, because it provide many date function for like change date formate, count diffrence between two dates in days etc. So, Basically i am going to show you change date format using Carbon. we will use createFromFormat() and format(), createFromFormat() will take two argument first give format of date and second one date and format() take one argument give formate as you want. you can see bellow example: <strong>Example:</strong> <pre class="language-php"> $date = date('Y-m-d H.....

By Hardik Savani | February 16, 2016 | | 8241 Viewer | Category : PHP
READ MORE

Laravel 5.2 and AngularJS CRUD with Search and Pagination Example.

Now i show you how to create CRUD(Create, Read, Update, Delete) using AngularJS and Laravel 5. In Following step by step you can create web application of create, edit, delete, lists, search with pagination of items modules. In this post through you can make simple crud, search and pagination module and easily use in your laravel project. I am going to show preview of items module that we will do using angularJS and Laravel 5.2. <strong>Preview</strong> <img src="/upload/laravel-angular.png" width="100%" style="border:2px solid cadetblue" /> <strong class="step">Step 1: Create items table an.....

By Hardik Savani | February 15, 2016 | | 158600 Viewer | Category : PHP
READ MORE

    How to add ckeditor with image upload in Laravel ?

    How to add ckeditor with image upload in Laravel ?

    Open Post

    How to install laravel framework on windows xampp server from scratch?

    How to install laravel framework on windows xampp server from scratch?

    Open Post

    Laravel 5 - Implementing datatables tutorial using yajra package

    Laravel 5 - Implementing datatables tutorial using yajra package

    Open Post

    Jquery select2 ajax autocomplete example with demo in PHP

    Jquery select2 ajax autocomplete example with demo in PHP

    Open Post

    PHP - jquery ajax crop image before upload using croppie plugin

    PHP - jquery ajax crop image before upload using croppie plugin

    Open Post

    Laravel 5 - Ajax crop image before upload using using croppie plugin

    Laravel 5 - Ajax crop image before upload using using croppie plugin

    Open Post