All Blogs by Toukir

Traits in Laravel
Traits in Laravel

By: Toukir Ibn Azad 0 0

Traits are mostly used for:
  1. Code reuse
  2. Flexibility in composition
Read more
Service Class in Laravel and usages.
Service Class in Laravel and usages.

By: Toukir Ibn Azad 0 0

Service classes are written to encapsulate codes and business logic separately from controllers. These classes should work for a service or operation. Unlike other classes, service classes do not inherit from other classes or controllers. Instead, the functions get called by object.

Convention:
  1. Should be stored under App\Http\Services namespace.
  2. Should have “Service” as a name suffix. Example: PostService, CommentService etc.
Read more
Code Laravel like a Senior Developer by using Service classes and Traits
Code Laravel like a Senior Developer by using Service classes and Traits

By: Toukir Ibn Azad 0 0

If you are working with laravel and still writing code like a junior developer without using some useful features for some structural methods is not that much good for big projects and your future opportunities.

I'd like to write about some useful techniques you can implement in your project development with laravel. It might be API or any web application.

The techniques are:

  • Using service classes.
  • Using traits.
Read more
Laravel Resource Routes for Learners
Laravel Resource Routes for Learners

By: Toukir Ibn Azad 0 0

You can write one line of code for defining a route for a CRUD operation, instead of writing different routes. This is called Resource Routes.

Why we need this?
Resource routes are a way of defining a set of routes that map to the various CRUD (Create, Read, Update, and Delete) operations for a resourceful controller.

1. Optimizes time and code.
2. Structured way.
3. Universal standard.

Read more
Real-time Communication with Laravel WebSockets
Real-time Communication with Laravel WebSockets

By: Toukir Ibn Azad 0 0

Laravel WebSockets is a package for Laravel 5.7 and up that will get your application started with WebSockets in no-time! It has a drop-in Pusher API replacement, has a debug dashboard, realtime statistics and even allows you to create custom WebSocket controllers.

The package will automatically register a service provider.

This package comes with a migration to store statistic information while running your WebSocket server.

Read more