Search in Snippets
 

All Projects

Building mini ecommerce in Laravel

Building RESTful APIs in Laravel

Building Mini Issue tracker with Laravel and Vue



All Snippets

How to use eloquent when - more elegant way of using if statement

If dynamic query is being built using eloquent builder based on dynamic search queries such as user id or post...


Using global scope in eloquent

Like local scopes for repeating eloquent conditions we can use global scope also to all queries of a given model....


Using local scope in eloquent

If there are repeating eloquent conditions in different methods and we can group and reuse those in different methods of...


Using brackets to specify two or more where clauses into its own where function in eloquent

Suppose we need to fetch records from post table where user id of post needs to be 1 and they...


Using whereDate, whereYear, whereMonth, whereDay and whereCreatedAt for dates

Following snippets would be able to fetch records based on given magic where() methods.01. whereCreatedAt - using exact value of...


Using findorFail() and firstOrFail() method

Without findorFail() method we need to implement like following snippet$post = Post::find(12333); if(!$post) { abort(404); } We can implement the...


Using parameters in find() method

find() does not only take single value as parameter like belowPost::find(1); find() method also can accept array like belowPost::find([1,2]) //...


Some definitions of migration, seeder and factory

MigrationsMigrations is used to create database schema/tableFactoryFactory file holds which field should have what value if you want to seed...


Using Seeder and factory to create dummy data for User, Post and Comment model

Step 01: create fresh laravel projectcomposer create-project laravel/laravel postcomment Step 02: Setting Up migration, factory of Post model and migration,...


Changing model values using mutators before saving in database

Sometimes we need to change model value before saving in the database. With help of mutators we can achieve this...


mahfooz

Hello, I am Mahfoozur Rahman and LCS is a site where I have been put together all my development experience with laravel in tutorials and step by step manner.

I am also working remotely for clients with development services so that they can achieve their business goals.

If that is what you want, you can contact me on mahfoozur.rahman.bd@gmail.com

I am currently also available for freelance work.

Categories

VS Code Tips and Tricks (2)
Restful API (1)
Coding Assistance (1)
Database Concepts (1)
Schema Design (0)
Data Retrieval (1)
Searching Data (0)
DevOps (1)
Amazon web services (1)
Livewire (1)
Crud (1)
Storage and retrieval (1)
Caching (1)
Frontend (2)
Select dropdown (2)
File Uploads (1)
File Uploads (1)
Vue (2)
Vite Vue (1)
Mixin (1)
Packages (1)
Debugging (1)
Security (1)
Authentication (1)
View (1)
View Composer (1)
Projects (99)
Model Performance (4)
Registration (1)
Login (1)
Restful API (16)
Topic oriented Community (1)
Mini Ecommerce (38)
Mini Blog (2)
Mini Issue tracker (28)
Database tables and data scaffolding (1)
Stripe (1)
Topic oriented user community (6)
Collections (7)
Collection Methods (7)
Sessions (2)
Storing Data (1)
Retrieving Data (1)
Improvements (7)
Laravel Code Snippets (6)
Mini Ecommerce (1)
Definitions (2)
Generating Commands (0)
Eloquent Builder (1)
Resource Controllers (0)
Seeding (1)
Executing Commands (0)
Controller (4)
Resource Controllers (0)
Middleware (4)
My Weeknesses (1)
My Weekness (1)
Eloquent ORM (50)
Eloquent Builder (30)
Seeding (4)
Relationship (6)
Configurations (8)
Accessors (2)
Artisan Console (4)
Executing Commands (4)
Generating Commands (0)