(30) get() method vs first() method | Diff b/w get() and first() | When use get or first Laravel

preview_player
Показать описание
Laravel first vs find vs findOrFail vs firstOrFail method
first()
find()
findOrFail()
firstOrFail()

laravel provides the first() method for getting a single row record. first() method use after a where condition and getting records that is match first. Example of first() method

Laravel find() method
laravel find() method also retrieve a single row record but it get record which primary key given in find($id) method. it not use where condition. Example of find() method

Laravel findOrFail() method
laravel findOrFail retrieve single row same as find() method it takes a primary key value in findOrFail($id) method and if any record exist on this id return data else return not found page. Example of findOrFail method.

Laravel series goal:
My goal with this Laravel series is to create a guide for those just learning Laravel. This guide will take you from the very beginning of an idea into a real deployable application.

Laravel step by step guide
Laravel full series
Laravel scratch to advance series
Laravel zero to hero course
Laravel guide

The project is stored in the given below directory.

#php
#phplaravel
#laravel
#webdevelopment
#cdl
#career_development_lab
#hadayatniazi
#coding
#technology
Рекомендации по теме