PHP


Laravel 5 datatables example from scratch

Data Tables is a plug-in for the jQuery Javascript library. DataTables provide us flexibility to search, list, sort and pagination using jquery. We can also simply use ajax with datatables too. So in this tutorial, i will tell you how to use datatables in laravel 5 application, after this you can simply use with all version like 5.1 to upcomming laravel 5.5 So, in this example i will use yajra/la.....

Posted On July 26, 2017

Laravel - chmod(storage/oauth-private.key): Operation failed: Operation not permitted

It's always make us mud less when we got strange issue or error. Same thing here describe. i got following error when i did work with git repository. I pushed my code and my friend pull that code and when he run he got following error: "chmod(storage/oauth-private.key): Operation failed: Operation not permitted" I google and try to run bellow command: <pre> php artisan passport:install </pre> Bu.....

Posted On July 25, 2017

Laravel generate random unique string example

Sometimes, we require to generate random string for token or something other login in laravel 5 application. if i remember exactly, 1 year ago i was working on my laravel 5 application at that moment i need to create unique string. I search on google and laravel docs i found str_random() helper of php laravel framework to generate random string, we need to just give then number as argument and i.....

Posted On July 25, 2017

PHP Laravel select2 js example from scratch

Here, I will let you know very simple example of generate select box using select2 jquery plugin in laravel application. Bootstrap provide very simple drop-down box. But if you want to add search with select box then you should use select2 js plugin. Select2 plugin provide us select drop-down box with search value and there are several feature available in select2 js. So in this example i am goin.....

Posted On July 19, 2017

Laravel 5 check if file uploaded or not using hasFile or isValid

It is very easy to check if uploaded file or image empty or not if you are using core PHP. But as we know laravel 5 provide us object of file, So we can not determine using empty(). However, we can simply do it using hasFile() and isValid() of laravel predefine. So i am going to give you basic example of both function one by one. So let's simply see both example and use it. <strong class="step-up.....

Posted On July 16, 2017

Laravel 5 global variable in all views file

Here, i will let you know how to set global variable in laravel 5 application. In this article i will set globle variable two way on simple view share and another using composer view share. As we know, every webiste or project there are several things are comman and access it in every page like footer text, logo, site title etc. So it is necessary to define it one time and access it on all views .....

Posted On July 16, 2017

Disable timestamps(created_at and updated_at) in Laravel 5 Model

As we know, Laravel added two field "created_at" and "updated_at" with timestamps. So when new record will be add then created_at and updated_at columns update current timestamps updated and when update then update then updated_at column. This is a default by laravel. But sometime, we dose not need to add created_at and updated_at column. So we have to stop add update those column, otherwise it r.....

Posted On July 11, 2017

Search comma separated value using find_in_set() in Laravel 5 Example

Here is a crazy example today, how to use find_in_set() mysql function in laravel query builder. If you need to add tags or something that store as comma separated values in database column, then you can simply store but if also need to search then it can be hard. Like if you have posts table with tags column you simply store data like "laravel,php,html" etc comma separated string then how you fo.....

Posted On July 9, 2017

PHP Laravel subquery in select statement example

I don't remember exactly, but i was working on my laravel 5+ application 2 months ago. At that moment i require to write subquery in select statement. I simply write in my mysql query and check it's work perfect. But i though how can it possible to write using laravel query builder. So first i am going to explain what was that. I have two tables <strong>"posts"</strong> and <strong>"post_viewer".....

Posted On July 9, 2017

PHP Laravel change date format example

Sometime, we may require to change date format in laravel view file or controller, so you can change your date format using carbon, date, strtotime. Here i gave you three example of change dateformat of timestamp column. In this example i have simple users table with id, name, email, created_at and updated_at column. In created_at column we store timestamp value like "Y-m-d H:i:s" and here i will.....

Posted On July 9, 2017

Blog Search