Laravel


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

How to change log file path in Laravel 5 ?

In Laravel framework, they store all error store in logs file and they keep in storage folder. Logs will help to find where is error and why in details. Because in every exception it put automatically in log file. You can also put manually log like as bellow few examples: <pre> Log::info('Info Log'); Log::alert('Alert Log'); Log::error('Error Log'); </pre> As above and there are others also avail.....

Posted On July 7, 2017

How to send email using gmail in PHP Laravel 5?

Laravel is very popular framework of php in todays. Laravel is famous because they provide several goods things like MVC, routing, mail etc. In this article we will learn how to send email using SMTP driver. Laravel 5 provide several drivers options like SMTP, Mail, SendMail and services supported include Mailgun, Sendgrid, Mandrill, Amazon SES, etc. So, here i will let you know how to send email.....

Posted On July 7, 2017

Laravel 5 - An access token is required to delete a video - issue

Someday ago. i was working on my laravel project and client need to upload video to youtube using google youtube api. Client ask me about this do you think you can upload video to youtube using package in laravel. I simply say yes because i know package and i thought it will be easy to do. But finally i started work on it and i used <a href="https://github.com/JoeDawson/youtube" target="_blank">.....

Posted On July 6, 2017

How to remove file if exists from folder in Laravel 5?

We almost require to file upload or image upload function in our laravel application. We simply make image upload functionality and put that image om our upload directory. But when record will delete from database then it should be remove from folder too otherwise there are several useless images store. So, in this article i will let you know how to check file exists or not then delete image or .....

Posted On July 6, 2017

Laravel 5 - Summernote Wysiwyg Editor with Image Upload Example

Summernote Wysiwyg is very simple and cool editor. If you use simply textarea and you require to make more tools like bold, italic or image upload, Then you have to choose Summernote plguin. In this article, i will let you know how to use summernote editor in our laravel 5 application. In this example i am going to use summernote with bootstrap. So you can simply use summbernote editor. If you .....

Posted On July 5, 2017

How to return response text/html from controller in laravel 5?

Few days ago, i was working on my new project and project was migrate project php into laravel. I need to migrate apis, So in old php application it returns response as text and i have to keep same response in laravel 5.4 application. So i thought how we can do it, finally i got it, we can do it using response(). response() helper will help to return simple text. So in my php it was like as bello.....

Posted On July 4, 2017