Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

Differences between php artisan dump-autoload and composer dump-autoload

When we are working on Laravel then we should know the php artisan and composer and the differences between php artisan dump-autoload and composer dump-autoload are: Laravel's Autoload is a bit different: 1) It will in fact use Compose...

Retrieving GET and POST data inside controller in Laravel 4

Retrieving GET and POST data inside controller in the basic requirement which should know everyone when we are working in any framework. In Laravel 4.x It is very easy to get "Get & Post" data. Examples: The Example for Get data is $...

Get all routes, Laravel 4

This is one of the important point which is not available on even stackoverflow. I want that by using one controller we at the moment which will handle every request that comes to my laravel 4.x application.This is one of the question which we sh...

Naming Conventions in CakePHP- Model, View, and Controller

CakePHP model, view, and controller naming conventions If we have a database with table named users, then following standard Cake PHP naming conventions should be used: 1. For Model filename = User.php classname = User directory...

Global filtering - how to use global scope in Laravel Eloquent

I have a situation which will help us to understand the use of Global Filtering. Situation: I have a published filter that I use for my articles. Guests can only view published articles, logged in users can view and apply filter (?published...

Drupal 7 database API

Drupal database abstraction layer allow's the use of different database servers using the same code base i.e it provides with the ability to support multiple database servers easily. The system is built a top PHP's PHP Data Objects database AP...

HTTP Long Polling

Hello readers today we discuss about "HTTP Long Polling". World-wide-web application coders can put into action an approach called HTTP extended polling, in which the client polls the server looking for brand new data. The particular server ke...

Laravel, get last insert id using Eloquent

Laravel 4.x we have a facility to get last inserted id easily. By showing one of my code you will get easily understanding. Example: $karmaNote = new Karmanote; $karmaNote ->reqid = $meetingId; $karmaNote ->conne...

How to create multilingual translated routes in Laravel 4.x

Now there are n number of site which we have to make multilingual. In Laravel we have the facility to make our site multilingual. In Laravel 4.x we will also make multilingual routes.There are few steps we have to follow to create multilingual t...

How to Calculate the difference between two dates in PHP?

Hello readers, today we will discuss about "Calculating the difference between two dates in PHP". For example, we have 2 dates and we wants to find the difference between them in php so we can use the below code: $date1 = "2007-03-24"; $da...

Difference between client-side and server-side programming

| ----------> HTTP request | +--------------+ | +--------------+ | | | | | | browser | | | web server | | (JavaScript) | ...

How to make controller,command using artisan in laravel 4.x

We can create controller and make command using artisan.The syntax for writing command for controller is: Syntax for writing Controller: php artisan controller:make ControllerName Example for writing Controller: php artisan control...

Insert a new record if not exist and update if exist, laravel eloquent

Laravel is very useful when we want to do basic operation .Suppose if we have a condition that we have to Insert a new record if not exist and update if exist, If we do this task in php then we have to put if-else condition But In Laravel 4.x we...

Get useful error messages in PHP

In case of syntax errors all you need to do to is to turn on error display in the php.ini. You may miss it because of it being turned off by default. Well, they are turned off by default because of a simple reason that a customer does not come a...

Determine which submit button has been clicked

If we have two submit buttons and want to detect which one is pressed then simply use post method i.e. $this->request->data. <?php echo $this->Form->create(false); ?> <?php echo $this->Form->text('input'); ?> &l...

Bulk Insertion in Laravel using eloquent ORM

Insertion is the very basic feature in every project. When we want to do bulk insertion there are n number of ways are available in Laravel to do bulk insertion. Some of the way to bulk insertion are: 1) By using Raw query in Laravel. 2) By ...

how to remove action name from URL in cakephp

Current URL is : http://mysite.com/MyController/view/page1 but if you want something like :http://mysite.com/MyController/page1 means you want to hide action name from URL. Then go to app/config/routes.php and type the below code. Rou...

Automatically deleting related rows in Laravel (Eloquent ORM)

I am using Laravel and I want Automatically deleting rows using Eloquent ORM .In laravel we have deleting event .By using this "deleting" event we can do all the clean up or what we want to delete we are able to delete. By using example ...

Using namespaces in Laravel 4

Namespaces plays an important feature of php. Namespaces are used to solve 2 major issues. 1) Authors of libraries 2) Applications encounter Laravel 4.x also provide namespace to solve those issues. The files are app/controllers/F...

User of Recursive in cakephp

It is used where ample data is fetched from the query and there are numerous levels of associations between your models. we use Recursive like this way. $this->Region->find('all', array('recursive' => 0)); These are levels of ...

Use of $this->set() in Cakephp

Hello Readers , In cakephp development framework we will use $this->set() several times . The set() method is basically use to create a variable in our view file i.e. ctp file . If suppose we have an array $userprofile and we want to ...

Passing variables from PHP to JavaScript in Drupal 7

Drupal provide a mean to pass information easily to JavaScript. Many applications want to pass configuration information to JavaScript that runs on a page. "Hello World!"), 'setting'); //Inline Js drupal_add_js('alert(Drupal.settings.hellow...

How to insert form data using Wordpress

Hello Reader's! If you are new to wordpress and looking for the method to insert form data into table, Then you can use the Wordpress liberary code to do that:- <?php global $wpdb; $wpdb->insert('wp_custom_user', ...

How to select from subquery using Laravel Query Builder?

Sub query is one the important section of database query.There are n number of situation where we want to implement sub query to fetch the data from the table. In Laravel 4.x there is no specific keyword to perform any sub query.To perform sub q...

Laravel 4: how to run a raw SQL?

There are n number of situation where we want to write complex query so It is very difficult to write complex query using Laravel.So to overcome such problem Laravel provide raw query option. The syntax of writing raw query is:- Syntax: DB:...

Setting up Laravel on a Mac php artisan migrate error: No such file or directory

I have all code in github and my project is running properly in Ubuntu system . I want to run and set up my Laravel project on a Mac and I am getting error "No such file or directory" when we write the command php artisan migrate ...

logging SQL queries

AJAX request runs a RAW parameterized Postgres SQL Query after receiving request Suppose we have a situation like that Here's my situation in my php view file, I make AJAX request to the server The AJAX request is received and runs a...

Difference Between WebService And API

Hello Readers There is difference between webservice and API. A Web Service is basically a type of API, which always operates over HTTP though some (like SOAP) can use alternate transports( like SMTP). An API is a (Application Programming I...

CakePHP Folder Structure

After downlaoding and extracting CakePHP folder, one should see the following files and folders: app cake vendors plugins .htaccess index.php README Three main folders in which one will usually work: 1.The app folder is one...

Base URL in Wordpress

Hello Reader's! In wordpress you can use the base url as written below <?php echo bloginfo('template_url'); ?> Lets take an example:- If you want to link the CSS <link rel="stylesheet" href="<?php echo bloginfo('temp...

How to create menu using Wordpress

Hello Reader's! If you are new to WordPress and you have to create the menu for first time. You just have to do the steps below:- Step1:- Open or Create a file functions.php in your theme folder and paste the code below:- add_action( 'after...

Website Development: 10 PHP Programming Mistakes Web Developers Should Avoid!

Source: www.finalwebsites.com PHP as a scripting language has gained immense popularity among web developers who strive to ensure that their websites are attractive and have a great functionality. Its because of PHP that developers are ab...

CakePHP request Cycle

When a user requests a page or a resource then the CAKEPHP request cycle starts. It can be explained with the below diagram: Let's now discuss the request cycle diagram with steps: 1.The request is redirected to webroot/index.php ba...

Pagination in Cakephp

In CakePHP pagination is provided by a Component defined in the controller for making paginated queries much easier. PaginatorHelper View is used for generating pagination links & buttons in a simpler way. Setting up the Query: Le...

How to replace any string using str_replace function in PHP

Hello Readers , While doing web development many times we stuck with the concept of str_replace . For understanding this, let's suppose we have one email template file stored in project directory and when we going to replace any string dyna...

Urlencode and Urldecode in php

Hello Readers Urlencode can be used to encode the given string that can be used as a url. Urlencode replaces the ASCII characters with % followed by two hexadecimal digits. OR Other non-alphanumeric characters are converted % followed...

Drupal 7 Adding Javascript and CSS file

including both of them to.info file scripts[] = hello_world.js stylesheets[screen][] = hello_world.css Adding a JavaScript file and a CSS file to a page $path = drupal_get_path('module', 'hello_world'); drupal_add_js($path . ...

User login to appear in a block

There could be a situation where you need to call login on multiple pages or block the below snippet of code could be helpful in this situation Calling the form function directly could help you getting the login form in a block or page ...

How to create progress bar for uploading file using PHP

Hello Reader's!, If you are developing the html 5 based form and need to show the progress bar of file uploading then you can use the following code written in PHP and Javascript:- The PHP html file will be go like this:- <?php //get ...

Drupal t() function and translations

syntax : t($string, array $args = array(), array $options = array()) Every string that may be displayed to a user should be wrapped in the t() function actually it takes the responsibility for translating strings from one language into ot...

How to make a cookie with no expire lifetime

Hello Reader's If you have writing the code that makes the cookies for valid lifetime then you just need to set big number for it's validity. As the example below PHP code:- Maximum value: 2147483647 setcookie("CookieName", "CookieValue", ...

How to check if a user has liked your Facebook page or not

Hello Reader's, If you are making the code for facebook page likes details and you want to know if the user has already liked your page or not, Then you can use the following library code for that :- <html> <head> <scrip...

Laravel 4 eloquent WHERE with OR AND OR?

In Laravel 4.x we can easily use where condition with OR AND OR .Below is the example of this Example: User::where(function ($query) { $query->where('a', '=', 1) ->orWhere('b', '=', 1); })->where(function ($query)...

Laravel 5.0 Including Sub View Into Another View

Many times we need some sections of HTML which need to be incorporated in many views and just to reduce redundancy we create separate views for it. An example to accomplish that is stated below:- Including other views in other view synt...

What are the best practices and best places for laravel 4 helpers or basic functions?

Many user will make a helper in app folder but if you want to use helper the best practice and best place to use Laravel 4.x helper in app/libraries folder. So all the basic function and helper we should define in app/libraries. Advantage o...

Laravel 5.0 Writing Static Query In Laravel

Many times we needs to write static query in Laravel. Some time due to the complexity of the query or sometime due to the MYSQL build in functions not supported in the Query Builder or in Eloquent in Laravel example LPAD. Thus at that time Larave...

Laravel check if related model exists

Below is the situation which I want to solve I have an Eloquent model which has a related model: public function option() { return $this->hasOne('RepairOption', 'repair&#95;item&#95;id'); } public function setOptionArray...

PHP Getting Time Elapsed Per Last Comment

Passing date to the function and returning the time passed or elapsed when it was commented/posted. It is very useful when you have comment section in your website and you want to show how earlier comment was posted. /** * Creating the dat...

Get the query executed in Laravel 4.x

In Laravel 4.x, We have a function by which we can run our query the syntax is Syntax: DB::getQueryLog() By using this function We can run our query. Example $queries = DB::getQueryLog(); $last_query = end($queries); We hav...

Oops and its features

Hello Readers Oops was introduced in php version 4 but the area of php version 4 is not very fast, as version 4 consists few features, hence the major concept of Oops are introduced in php version 5 which is called php5. Oops include the b...
1 31 44
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: