Author: drweb

laravel globale search getModel()->getFillable(); $relations = $builder->getModel()->getRelationsInModel(); return $builder->where(function ($query) use ($searchableFields, $request) { //search in model with any word if ($request->filled(‘search’)) { foreach ($searchableFields as $key => $value) { $query->Where($value, $request->search); } } //search with relations foreach ($relations as $relationName => $relatedModel) { $searchableFieldsRelated = $relatedModel->getFillable(); foreach ($request->all() as $key => $value) { if (in_array($key, $searchableFields) && !is_null($value)) { $query->orWhereHas($relationName, function ($query2) use ($key, $value) { $query2->where($key, $value); }); } } } }); } }

Read More
PHP

PHP Constructors and Inheritance When working in OOP PHP, understanding constructors is essential for manipulating objects. Constructors are magic methods that get invoked when an object is instantiated from a class. They typically handle the initialization of an object’s properties. These initialisations are split between parent and child classes, and the relationship between parent and child class constructors can be somewhat confusing. There is much to say about PHP constructors and inheritance. In this post, we’ll explore PHP constructors in the context of inheritance and what it means when a child constructor explicitly calls the parent constructor. What Is a…

Read More
PHP

News Releases .env files are widely used to configure applications by storing configuration settings, environment variables, and sensitive information. This eliminates the need to hardcode these values into the application code. Previously, developers using PhpStorm had to manually install the .env Files Support plugin, originally created by Adel Faizrakhmanov, to unlock dedicated features for working with these files. Wanting to ensure that PhpStorm users have everything they need for web development already built into the IDE, we reached out to Adel about transferring ownership of his .env Files Support plugin to JetBrains for bundling – and he graciously supported this…

Read More
PHP

While browsing the PHP devsquad, I ran into this article that listed the top 10 powerful features of PHP. Beside the list, it made me wonder what are the adoption levels of recent PHP features, based on this list. Once in a while, I like to check such top 10, to see how main stream PHP features are becoming. After all, there is a step between what is announced at the new version release, and how features are adopted (I’m looking at you, spaceship operator. And working on Exakat tends to keep me looking at exotic parts of PHP. A…

Read More
PHP

@media (min-width: 769px) { main .article-section .content ul:not([class]):not([id]) li ul:not([class]):not([id]) { margin-top: 0; margin-bottom: 24px; } } main .article-section .content ul:not([class]):not([id]) li, main .article-section .content ul:not([class]):not([id]) > li {padding-bottom: 18px;} main .article-section .content ul:not([class]):not([id]) li ul:not([class]):not([id]) li {padding-bottom: 0;} img.alignico {margin-right: 10px;margin-top: 5px;float: left;} summary {display: list-item;cursor: pointer;font-style: italic; } section.article-section a {color: #7755f3} code {color: red;} #roman-pronskiy,.copy-heading:has(#roman-pronskiy){margin-top: 0;} main li a[href^=”https://github.com”]:before {background: no-repeat 2px center url(data:image/svg+xml;utf8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNCIgaGVpZ2h0PSIxNCIgZmlsbD0ibm9uZSIgdmlld0JveD0iMCAwIDMyIDMyIj48cGF0aCBmaWxsPSIjMjQyOTJFIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNiAwYTE2IDE2IDAgMCAwLTUgMzEuMmMuNy4xIDEtLjQgMS0uOHYtM2MtNCAuOC01LTEtNS40LTEuOC0uMS0uNS0xLTItMS42LTIuMy0uNi0uMy0xLjQtMSAwLTEgMS4yIDAgMi4xIDEuMSAyLjQgMS42IDEuNSAyLjQgMy44IDEuNyA0LjcgMS4zLjEtMSAuNi0xLjcgMS0yLjEtMy41LS40LTcuMy0xLjgtNy4zLTggMC0xLjcuNy0zLjEgMS43LTQuMi0uMi0uNC0uNy0yIC4xLTQuMyAwIDAgMS40LS40IDQuNCAxLjdhMTQuOCAxNC44IDAgMCAxIDggMGMzLjEtMi4xIDQuNC0xLjcgNC40LTEuNyAxIDIuMi40IDMuOS4yIDQuM2E2IDYgMCAwIDEgMS42IDQuM2MwIDYuMS0zLjcgNy41LTcuMyA3LjkuNi41IDEuMSAxLjQgMS4xIDN2NC4zYzAgLjQuMyAxIDEuMS44QTE2IDE2IDAgMCAwIDE2IDBaIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=);content: “”;padding-left: 20px;} main li a[href^=”https://www.youtube.com”]:not([data-test=”blog-header”]):before {background: no-repeat 0px center url(“data:image/svg+xml,%3Csvg xmlns=”http://www.w3.org/2000/svg” height=”100%25″ version=’1.1′ viewBox=’0 0 68 48′ width=”100%25″%3E%3Cpath class=”ytp-large-play-button-bg” d=’m .66,37.62 c 0,0 .66,4.70 2.70,6.77 2.58,2.71 5.98,2.63 7.49,2.91 5.43,.52 23.10,.68 23.12,.68 .00,-1.3e-5 14.29,-0.02…

Read More
PHP

If you’ve ever coded, you’ve likely encountered cryptic error messages that left you scratching your head. Whether it’s a syntax error, an unexpected function call issue, or a deprecated feature warning, debugging can be a frustrating experience: this also happens with PHP. That’s where the PHP Error Message Encyclopedia (PEME) comes in. This extensive reference provides clear explanations for over 500 PHP error messages, helping developers of all levels understand what went wrong and how to fix it efficiently. What to expect in the PHP Error Message Encyclopedia? The PHP Error Message Encyclopedia is a well-organized reference guide that documents…

Read More
PHP

News Read this post in other languages: PHP continues to be a cornerstone of web development, powering millions of websites around the world. Its vibrant and dedicated community values its flexibility and ease of use. But what does the current state of PHP development look like? To uncover deeper insights and trends shaping the ecosystem, we’ve turned to our in-house expert, Brent Roose, Developer Advocate for PHP, who will guide us through the results of the State of Developer Ecosystem Survey 2024. Join us as we explore the findings and learn how PHP developers are navigating the ever-evolving landscape of…

Read More

Note: The key name x in the style prop is an arbitrary choice. I could’ve written:{(style) => }Use the key name that indicates most clearly what you’re animating.StaggeredMotion works slightly differently than in that everything is now multiple instead of singular. Instead of providing a defaultStyle we provide defaultStyles and instead of providing style we provide styles.Considering we want to animate multiple things this makes sense. One other caveat: the styles prop is now a function of previous styles. Sounds confusing, but once we apply it, it all makes sense.Since we are responding to user touches here we must bring…

Read More

The struggle is realMastering these simple Flexbox recipes will make you a React Native UI master in no timeGetting StartedLets start with a simple example. A container View component with three Text components.//Our views 1 2 3 //Styleslet styles = StyleSheet.create({container: { backgroundColor:’#4286f4′},viewStyleOne: {width:40,height:40,justifyContent: ‘center’,alignItems:’center’, backgroundColor:’#b642f4′},textStyle:{textAlign:’center’}})Which renders as so:Initial ViewNow we add flex:1 to the container:container: { backgroundColor:’#4286f4′, flex: 1 }This makes container fill its parent, i.e. whole screen.flex : 1Now we add:container: { backgroundColor:’#4286f4′, flex: 1,flexDirection:’row’}Each view’s flexDirection is set to colum by default but setting it to ‘row’ will change the orientation of the items in the container.flexDirection…

Read More

Do you write React Native or JavaScript articles and want to be featured in our blog? Reach out to wyatt@reactnativecoach.com and we’ll review your submission.Great post from Andi Gu on recreating the chat bubbles animation effect from the Facebook app in React Native.Excellent article for all React Native devs on common Flexbox recipes from Navdeep Singh Bedi.Didn’t know about these StyleSheet helpers, from Asa Miller.Incredible post from Zohar Levin on creating a header scrolling animation using scroll position in React Native.Learn how to set environment variables for specific release channels in Expo from Peter Piekarczyk.Nice example project using the Github…

Read More