JSON fields are gaining more popularity since they became officially supported in MySQL 5.7.8. Even the popular Spatie Laravel Medialibrary package use them, so why shouldn’t we? This tutorial will show you an example. Let’s say we have an e-shop project and want to store products. For some of them, we don’t really know what the fields will be – some will require sizes, others will require colors, origin country, manufacturer etc. So here’s where JSON field may become useful – we will store whatever custom properties data there. Here’s the form for our product: Notice: For the simplicity, I didn’t implement JavaScript add/remove dynamic fields, this is outside of JSON fields article. Here it’s hard-coded to 5 fields. Step 1. Back-end: Migration + Model To create a JSON field, all we need to do in Laravel migration is use ->json() method: Next, we need to tell our model app/Product.php to cast that column from JSON to an array automatically: This way, we will receive $product->properties as array and don’t need to do json_decode() at all. Step 2. Blade Form With Array As I mentioned before, I added five fields for properties, user may fill one of them or all five: As you can see, a simple @for loop and every key-value pair has an index in the array, from 0 to 4. Step 3. Saving Properties Our ProductController::store() method will be simple. Yes, that’s it. Some validation for required fields in StoreProductRequest, but nothing more fancy. And we don’t need to do anything with our JSON field, because we’re already passing the array from Blade, so it will be automatically...
Empowering individuals through education is a core belief here at Appetiser. Learning about the education problem in the Philippines was disheartening as we’ve grown a special connection with the country through working with so many talented Filipino team members. 1 out of every 10 young Filipinos aged 6 to 24 is considered an out-of-school-youth (OCSY). This means that more than 4 million Filipinos have not enrolled in formal schooling or graduated from secondary school despite laws that promote the accessibility of free public education in the country. This problem has only intensified because of the Covid-19 pandemic. Enrolment for the school year of 2020 – 2021 dropped 27.3% due to the economic burden of distanced-learning and the need for children to work because of insufficient family income to meet necessities. Our company philosophy has always focused on self-development and team member growth with education playing a big part in this. We’ve witnessed our Filipino team members’ talent and potential made possible by access to a great education. Our aim is to help alleviate the problem faced by so many of the Philippines most vulnerable children, giving them better access to education and in turn, to jobs and opportunities in their futures. So our team efforts began this year to give back to a country that has given us so much. A cause aligned with our core values World Vision is the right partner because of their dedication to making education accessible for all. They’ve worked with children and local communities around the Philippines and the world. In the last three years, the organisation was able to help 3.1 million...
As marketers, we strive to design customer experiences that leave lasting impressions, drive conversions and keep our customers coming back for more. But do we rely too heavily on big data instead of honing in on the specific actions that drive customer engagements? A recent report from Forrester commissioned by customer insights software firm FocusVision surveyed over 500 U.S. consumers to describe what they thought and felt was a truly memorable customer experience and the specific elements of the component that made it memorable. Forrester also surveyed over 200 B2C marketing decision-makers, including 54 CMOs, to gain insight into what methodologies they use to understand their customers. The report defines big data as a “combination of structured and unstructured data, including log files, transaction information, internet of things, social media metrics, etc.” It defines small data as “a combination of VOC data, customer journey data, user focus groups, surveys, behavioral user experience data, etc.” Small data unlocks the “why” behind customers’ actions Over-reliance on big data is a common trend, according to the report findings. When asked if their customer experience strategy and execution was informed more by big data or by small data, nearly a third (29%) of the respondents said they rely “completely” on big data when making decisions. Looking only at big data often leads digital marketers to convoluted customer insights and challenges in terms of understanding the drivers behind customer actions. More than half of the brands surveyed agreed or agreed strongly that small data is critical to unlocking the thoughts and emotions behind the actions customers take. Forty-one percent of brands using small data...
Cyber security is the practice of defending computers, servers, mobile devices, electronic systems, networks, and data from malicious attacks. It’s also known as information technology security or electronic information security. The term applies into a variety of contexts, from business to mobile computing, and can be divided into a few common categories. Application security focuses on keeping software and devices free of threats. Network security is the practice of securing a computer network from intruders, whether targeted attackers or opportunistic malware. Information security protects the integrity and privacy of data, both in storage and in transit. Operational security includes the processes and decisions for handling and protecting data assets. The permissions users have when accessing a network and the procedures that determine how and where data may be stored or shared all fall under this umbrella. The global cyber threat continues to evolve at a rapid pace, with a rising number of data breaches each year. A report by Risk Based Security revealed that a shocking 7.9 billion records have been exposed by data breaches in the first nine months of 2019 alone. This figure is more than double (112.0 per cent) of the number of records exposed in the same period in 2018. With the scale of the cyber threat set to continue to rise, the International Data Corporation predicts that worldwide spending on cyber-security solutions will reach a massive US$133.7 billion by 2022. Governments across the globe have responded to the rising cyber threat with guidance to help organisations implement effective cyber-security practices. In the U.S., the National Institute of Standards and Technology (NIST) has created a...
Imagine a Laravel project with 100+ routes, separate section for guest, users, administrators etc. Do you really want to keep it all in one file? How can you group them, add prefixes to URLs? Let’s see what options we have. 1. Separate WEB and API Routes This one is easy, as Laravel is shipped with this feature by default. There are two files: So if your project has both visual web-pages, and API (which is more and more common these days), please put API routes in that separate file. For example, if you have /users page and then /api/users/ endpoint, separating them into their own files help to not get confused with the same names in the same file. That said, I recently saw counter-intuitive example from official Laravel project. With Laravel Horizon, Taylor has only API routes, and he didn’t use separate file, instead he put it into routes/web.php: Another proof that structuring in Laravel is very personal and there is no 100% standard, even from Taylor himself. 2. Structure routes/web.php File into Groups That also comes from “basic” Laravel – route grouping. This is an example from the official Laravel documentation: The most basic usage is hiding different groups under different middleware. For example, you want one group to be restricted by default auth middleware, another group by separate admin custom middleware etc. With that, you can also use Route group names and prefixes. Again, a few examples from the official documentation: Also, if you want to add all middleware+name+prefix to one group, it’s more readable to put them into an array: Let’s tie it all together...
ios developer singapore,website development singapore,mobile apps development singapore,singapore mobile application developer,web designer singapore,mobile application development singapore,mobile developer singapore,ruby on rails developer singapore,website designer singapore,design firms in singapore,app development singapore,developers in singapore,mobile application developer singapore,design agency singapore,mobile app developer singapore,android developer singapore,singapore mobile app developer,web design services singapore,app developer singapore,singapore web design services,mobile game developer singapore,website developer singapore,singapore app developer,developer in singapore,web development singapore,singapore website design,mobile apps singapore,ios app development singapore,web development company singapore,mobile app development singapore,singapore web design,web design singapore,graphic designer in singapore,singapore web development,website design singapore,web design company singapore,web application singapore