Apr 7 路 4 min read 路 ABSTRACT: 馃З Analogy for Frontend Developers A Trait in Rust is exactly like an interface in TypeScript. Think of a Trait as a Contract or a Job Description. It is a way to define shared behavior in an abstract way, forcing different types of data t...
Join discussionMar 28 路 19 min read 路 PHP Traits vs Abstract Classes vs Interfaces: When to Use Each PHP's OOP system gives you three tools for sharing behavior -- traits, abstract classes, and interfaces -- but each one solves a fundamentally different problem. Picking the wrong one lea...
Join discussionOct 31, 2024 路 3 min read 路 PHP Traits What are Traits in PHP? Imagine you're building a house, and instead of constructing everything from scratch, you could simply pick up pre-made modules and attach them wherever you need. In PHP, Traits are exactly like these modular buildi...
Join discussion
May 28, 2024 路 9 min read 路 Hey there! Today, let's dive into some of Rust's more advanced concepts: Generic Types and Traits. These might sound a bit intimidating at first, but I'll walk you through each step with practical examples. By the end of this, you'll be able to use t...
Join discussionMay 17, 2024 路 3 min read 路 In the dynamic realm of web development, every tool that enhances efficiency is a treasure. Laravel, the PHP framework known for its developer-friendly features, continues to innovate with each iteration. With the unveiling of Laravel 11, developers ...
Join discussionDec 14, 2023 路 7 min read 路 This blog is a summay of Chapter 2.8 of Rust Course (course.rs) Generics Generics can be used in structs, enumerators, and methods, as shown in the example below: 1 Using generics in structs: struct Point<T> { x: T, y: T } fn main() { le...
Join discussionJul 22, 2023 路 13 min read 路 Why Rust? I've casually had my eye on Rust for quite a bit now. A couple of years ago I joined a hackathon leveraging some Web3 technologies at the height of the crypto hype, and learned about smart contracts. At the time, the chain we were building ...
Join discussion
Nov 5, 2022 路 2 min read 路 Let's say you want to use multiple traits in your models to reuse common code such as applying UUIDs and settings global query scopes like this: use HasUuid; use HasTenant; Each of these traits has a boot method: HasUuid: trait HasUuid { public f...
Join discussion