Categories
Laravel

Eloquent – A better way to increment or decrements an int

Laravel has in-built increment() and decrement() functions to increase or decrease a value of the column, by 1 or with the given number. Below are the examples: That’s it – it will actually run update column + 1 under the hood. You can specify a second parameter to this function, the amount of incrementing. The […]

Categories
Laravel

How to Upload, download, remove Files to Amazon S3 Using Laravel

Create a controller called UploadController.php with following code. Create a view file Create a file called upload.blade.php in the resources/views directory and place below inside it. Define Routes Open your routes/web.php directory and add following route definitions to it.

Categories
Laravel

How to use Datatables in Laravel 5.8

In this tutorial, I will show you how to use the Datatables in the Laravel based project withyajra/laravel-datatables-oracle package. For this tutorial, we gonna use Laravel 5.8 version but the Datatable package usage steps will be pretty simpler with other versions of Laravel framework. As a first step lets setup a brand new Laravel project […]

Categories
Laravel

How to create RESTful API in Laravel 5.7

In this tutorial, I will show you creating RESTful apis using Laravel 5.7 php framework. We gonna use the Laravel’s API resources to build RESTful APIs. Laravel’s API Resource class is a way to transform data from one format to another. For example, if you have a comment model and you want to manipulate the […]

Categories
Laravel

Laravel Eloquent Increments and Decrements value

In this post, I would like to show you the hidden and useful functions of Laravel’s Eloquent ORM to Increment and Decrement value of the fields in the database column. In my recent project, I used increment() and decrement() methods to increase and decrease the numbers respectively. How to use increment() and decrement()

Categories
Laravel

Laravel 5.6 Socialite Bitbucket Login

In this tutorial, we’re going to explain how to integrate Bitbucket login in Laravel based application using Socialite. The Socialite is Laravel’s official package, which is making is easy to authenticate with external services with OAuth providers. Create Project Create a brand new Laravel 5.6 project with Composer create-project command: Database connection settings After creating […]

Categories
Laravel

Laravel 5.6 Socialite GitHub Login

In this tutorial, we’re going to explain how to integrate GitHub login in Laravel based application using Socialite. The Socialite is Laravel’s official package, which is making is easy to authenticate with external services with OAuth providers. Create Project Create a brand new Laravel 5.6 project with Composer create-project command: Database connection settings After creating […]

Categories
Laravel

Laravel 5.6 Socialite LinkedIn Login

In this tutorial, we’re going to explain how to integrate LinkedIn login in Laravel based application using Socialite. The Socialite is Laravel’s official package, which is making is easy to authenticate with external services with OAuth providers. Create Project Create a brand new Laravel 5.6 project with Composer create-project command: Database connection settings After creating […]

Categories
Laravel

Laravel 5.6 Socialite Google Login

In this tutorial, we’re going to explain how to integrate Google login in Laravel based application using Socialite. The Socialite is Laravel’s official package, which is making is easy to authenticate with external services with OAuth providers. Create Project Create a brand new Laravel 5.6 project with Composer create-project command: Database connection settings After creating […]

Categories
Laravel

Laravel 5.6 Socialite Facebook Login

In this tutorial, we’re going to explain how to integrate Facebook login in Laravel based application using Socialite. The Socialite is Laravel’s official package, which is making is easy to authenticate with external services with OAuth providers. Create Project Create a brand new Laravel 5.6 project with Composer create-project command: Database connection settings After creating […]

Categories
Laravel

Laravel 5.6 Socialite Twitter Login

In this post, I would like to show you, how we can use Laravel’s Socialite plugin to use Twitter authentication in your Laravel based application. To use twitter authentication APIs we need client ID and client secret and we can get these details from twitter app center. So lets login to https://apps.twitter.com/ and create a […]

Categories
Laravel

How to get last inserted id in Laravel

In this post, I would like to show the different ways to get last inserted ID from the database table when working with Laravel PHP Framework. In the core PHP, we will get last inserted ID with mysqli_insert_id() or PDO::lastInsertId() methods, but in Laravel framework you don’t need have to use those methods. In the […]

Categories
Laravel

Laravel create a json file and append content to it.

In this post, I would like to show you creating a JSON file and appending content to it whenever somebody submits a form. For this tutorial, I am gonna use Laravel 5.6 version. Let’s create a brand new Laravel project via Composer Create-Project command. lets issue following command from your terminal: It will create a […]

Categories
Laravel

How to delete file(s) in Laravel 5

Deleting files from the file system is very common task nowadays and it can be done in several ways. But here I am gonna show you deleting files in the Laravel way. We generally use PHP’s built-in unlink() function to delete files from the file system, there is nothing wrong using it. But we gonna […]

Categories
Laravel

Laravel 5.6 – REST API – JWT Authentication

In my last tutorial, we created an APIs for todo application without authentication. In this tutorial, I would like to show you building JWT based login system. Let’s start… Create Project Create a brand new Laravel 5.6 project with Composer create-project command: Database connection settings After creating project open .env file and update your database […]