Tag : Object


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 | | 6155 Viewer | Category : Laravel
READ MORE

How to parse json in jquery ajax?

When you are working php or .net etc and you return data like json_encode($data) on ajax request. but in front side you get like a string at that time you have to parse json object and get them. so, let's see example and learn how to use: <strong class="example">Example</strong> <pre class="prettyprint lang-php"> var request = $.ajax({ type: 'POST', dataType: 'json', url: 'http://www.mysite.com/getpostuser', data: {token:obj['token'],postid: obj['postid']} }); request.done(function(msg) { msg = JSON.parse(msg); msg.forEach(function(items) { var e = "notify-"+items.userid; .....

By Hardik Savani | April 5, 2016 | | 1216 Viewer | Category : PHP Javascript jQuery Ajax
READ MORE

How to use foreach object in Nodejs ?

Normally, we does use foreach loop in PHP, JS etc, but when i was working on socket programming at that time i require to use foreach of object in server.js. I did also search on google and try to how to use foreach in Node JS. At last i found to use forEach and solve it. so, let's see following example. <strong >Example</strong> <pre class="prettyprint lang-php"> socket.on("newmessage", function(obj) { obj = JSON.parse(obj); obj.forEach(function(items) { console.log(items.userid); var e = "notify-"+items.userid; io.sockets.emit(e, 1); }); }); </pre>

By Hardik Savani | March 31, 2016 | | 1390 Viewer | Category : PHP Laravel Node JS
READ MORE

How to convert Object into Array in PHP?

Whenever you need to convert object to array in your php project then you can do that using (array). It is a pretty simple example to convert php object into array that way you can use array. So, let's see the following example. <strong class="example">Example:</strong> <pre class="prettyprint lang-php"> $myObject = new MyClass; $myObject->id = 100; $myObject->title = "posts"; $myObject->description = "this is posts"; $newArray = (array) $myObject; print_r($newArray); </pre>

By Hardik Savani | March 25, 2016 | | 758 Viewer | Category : PHP
READ MORE

    PHP - import excel file into mysql database tutorial

    PHP - import excel file into mysql database tutorial

    Open Post

    Jquery - Show hide password in Password textbox using checkbox.

    Jquery - Show hide password in Password textbox using checkbox.

    Open Post

    Solved - Access Not Configured. Google+ API (truncated...) on google console developer

    Solved - Access Not Configured. Google+ API (truncated...) on google console developer

    Open Post

    Select box with search option example in Jquery using Chosen Plugin

    Select box with search option example in Jquery using Chosen Plugin

    Open Post

    AngularJS - How to render HTML value in ng-repeat ?

    AngularJS - How to render HTML value in ng-repeat ?

    Open Post

    How to create authentication(login and registration) in Laravel 5.2?

    How to create authentication(login and registration) in Laravel 5.2?

    Open Post