Category: Laravel

Laravel get records with Order BY

In your Laravel application if you want to get some records according to date you entered you can use the Order By clause as shown in below

Here you are using order_date field to select records by descending order. I am using pagination method to get only the first 20 records

Read more

Laravel Resource Controller

How to Creare Resource Controller You can create the resource controller using following artisan command

This resource controller will have the CRUD methods as shown in the following table Verb URI Action Route Name GET /products index products.index GET /products/create create products.create POST /products store GET /products/{product} show GET /products/{product}/edit edit products.edit […]

Read more

Laravel RESTful API Development

These days REST API plays major role in web development and developers are heavily use REST API when they build applications. REST is very popular because it is very simple to use and you can build it on top of the HTTP. What is REST? REST stands for Representation State Transfer. We will try to […]

Read more

Laravel API Resource for API end point

I need to get the Json objects when I call the Get request API end point First thing you have do is create the normal controller using following artisan command

And create the Product model too Then you create the resource controller at App\Http\Resources location

Which will produce thw folllwong code


Read more

Pass variable to Mail::send() function in Laravel

If you need to pass variables to Mail::send() function in Laravel you can use the following code.

I have passed the subject parameter using the $data array

Read more

Laravel 5 – Remove public from URL

When you install Laravel in your server you will get URL like this to list your customers I need somethig like this This is the solution 1 Rename server.php in your Laravel root folder to index.php 2 Copy the .htaccess file from /public directory to your Laravel root folder.

Read more

Response to preflightLaravel – request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’

You will get following errors when you test your REST API application with React, Vue.JS and angular You will get following errors when you call the REST api

Failed to load Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://localhost:3333’ is therefore […]

Read more

Laravel with Vue.js

If you want to getting started with Laravel + Vue.js you can following the simple steps given below

Read more

How to pass data to view in Laravel

You can use the following code to pass to view in Laravel

Read more

How to make HTTP client get request with Guzzle in Laravel

First you can go the root of your Laravel project in terminal and run the following command to install Guzzle package

Read more