Category: Laravel

Laravel Eloquent

Laravel Eloquent ORM is the Active Record implementation Each database table has a corresponding model and you can use these models to query, insert, update and delete. You can first create a model with artisian command and then create the corresponding table in database( We call this migrate) How to create model How to create […]

Read more

Laravel Route two parameters

To pass multiple parameters with Laravel route you can define your route

Read more

Laravel Relationships

#One to Many Relationship Model Form Model Step Form can have multiple steps You can define the relationship inside the Form model In your view file show.blade.php

Read more

Laravel custom errors

When you develop Laravel application you may need to send custom error messages from Laravel Controller to the Laravel View. So you can have the following code inside the controller Here I am redirect to the same route But if you want to redirect to a view you can use the following code Now inside […]

Read more

API Authentication using Laravel Passport – Complete Guide 2020

In this tutorial we will see how to create API Authentication using Laravel Passport package. This very use full when you write Vue.js application because you have to authenticate your Restful Api using the Laravel Passport Authentication system Laravel Passport is complete OAuth2 server implementation. If you try to implement OAuth2 from scratch it is […]

Read more

Get next id in auto generated field in Laravel

You can use the following code to get the next id of the auto generated field of the table in Laravel,

Read more

Redirect to specified route after logout – Laravel

Redirect after logout In default Laravel app, once you logout it will redirect to the home page. But you can change where to redirect after you log out. Never edit the core files located at your vendor folder that will override when you update the Laravel versions In Auth\LoginController you have the following trait You […]

Read more

Laravel Gate::define easy code

You can us the following code define your all gates. Permission table has got the control name,action and models This code is ok for small web application. If your project is gig with several user role this code is not going to work because you have to use lots of If – else condition check […]

Read more

Fetch select fields on a hasMany relation

https://stackoverflow.com/questions/30022038/fetch-specific-fields-on-a-hasmany-relation

Read more

Set Selected on Select Form Control in Laravel

In your blade file, you have to set the select option when you are in edit mode. You need to get output like this To get the above output you can use the following code

Read more