[Solved] Call to undefined method App\Models\User::createToken()

Normally “Call to undefined method App\Models\User::createToken()” error comes during working on Passport API authentication. So in this blog post, we solve this issue in simple two-line. just flow me. App\Models\User.php Add method createToken is in HasApiTokens trait, you should use it In your User Model. At the above code, I added two line and I … Read more

How To Make Multi Auth In Laravel 8 [With full Source Code]

How To Make Multi Auth In Laravel 8

In this blog post, we learn How To Make Multi Auth In Laravel 8. We know laravel gives us a default auth for users but in some cases, we need another auth for admin or seller. So first here I am using a fresh laravel 8 application so first, install a laravel application and generate … Read more

How to Add and Remove “Required” in Jquery

Add and Remove Required in Jquery

In this blog post, we learn how to add and remove a required attribute in jquery. By this method, You not only able to remove or add the “required” attribute, But you can remove or add another attribute also. We do the task using attr() method. The attr() method sets or returns attributes and values … Read more

Auto Calculate Total Price in Javascript

Auto Calculate Total Price in Javascript

In this blog post, we learn how to auto calculate the total price on input change. This is task is very important when you are but an e-commerce project. where we need real-time calculation of product selection. To achieve this task we use getElementById() . It returns an Element object representing the element whose id property matches … Read more

Show and Hide a Div Onclick in Javascript

Show and Hide a Div Onclick in Javascript

In this blog, we learn how to Show and Hide a div on the click button in Javascript. there are several methods to do the job. In this blog post, I covered two methods first one is getElementById() and the second one is getElementsByClassName(). Method 1 : getElementById() The getElementById() returns an Element an object representing the … Read more

How to Get the Last Character of String in Javascript?

Get the Last Character of String in Javascript

In this blog post, we learn how to get the last character of string in javascript. To find the last character we have two easy methods. The first one is a slice() and another method is length properties. Method 1: Slice() The slice() the method extracts a section of a string and returns it as a new … Read more

How Pass PHP Array to Javascript

How Pass PHP Array to Javascript

The PHP array can be used in the javascript function in many ways. But today in this blog we will use the main two ways. The first one is json_encode() and the second one is most common PHP implode() function. Method 1 : json_encode() First, define an array into PHP. json_encode() returns the JSON representation … Read more

Find Longest, Shortest, and Random String in Array in Javascript

Find-Longest-Shortest-and-Random-String-Javascript

1. Find Longest String in Array Here I define an array list of six elements and we can see the Longest string is “Performance”. So run this script to get an answer. To Find the string we use reduce(). The reduce() the method executes a reducer function (that you provide) on each element of the array, resulting in a … Read more

Submit Laravel Form Using Ajax Post Method with Validation

laravel ajax form by post method

In this post, we learn how to submit a form by the Ajax post method in laravel. Ajax is great to submit forms or get data from the database without reloading or refresh the page. We also validation our data in the Laravel controller and show an error message in your blade file. Step 1: … Read more

Laravel Eloquent Multiple Where

Laravel Eloquent Multiple Where

hello developers, in this post, we will learn how to use “Laravel Eloquent Multiple Where”. as we knew that “where” is uses to make conditions in the query. Generally, we use a single “where Eloquent”, But sometimes we need multiple “where” conditions for a query. So here I will show how to use multiple where … Read more