teleren/devto huggingface dataset:
Laravel 8 Resource Route Controller Example

Published: 2021-05-04 16:23:59

In this example we will show laravel 8 resource route controller example. This example will give you simple example of laravel 8 resource route. we will show laravel 8 resource routing example. Today i explain step by step what is resource route in laravel 8.

You can simply understand of resource route and controller in laravel 8 application. You have to create resource route on laravel they provide insert, update, view, delete routes and second you have to create resource controller that will provide method for insert, update, view and delete.

So, in this example we will see how to create resource route in laravel 8 and how they work.

First we have to understand why we choose resource route instead of different route. we always declare different different route for our crud application like as bellow:

[Laravel 8 Resource Route Controller Example
](https://web-tuts.com/laravel-8-resource-route-controller-example/)
Javascript functions vs Java functions
Tags: javascript
Published: 2021-05-04 16:07:26


A post on how javascript functions differ from Java functions. 
Would help java developers trying their hands on javascript :

1. You don’t specify the type of javascript parameters
2. Javascript functions don’t need to live inside a Class
3. Javascript functions can be assigned to a variable
4. Javascript functions can be passed as parameters to other functions
5. You can pass any number of parameters to a javascript function

Explanation with samples :
https://fullstackdeveloper.guru/2021/05/04/how-do-javascript-functions-differ-from-java-functions/
Love Specialist Astrologer +91-9779664999
Tags: shastri
Published: 2021-05-04 15:59:38

Love always makes us to feel happy. We never want that our love life should suffer. Thus whenever there are problems we must have to try our best to come out from all those problems. Getting to an expert is something which helps a lot to every person. There are many people those who have seen that love problems could simply get solve. When we have start taking help of Love Specialist Astrologer then of course there are many such problems which could be ended. Many troubles could come and go and we must have to try our best whenever it comes to end the love problems. Thus taking help of an expert is always good. 

Getting to an astrologer is always good. When a person has start taking astrological remedies no worries could come in their life. Love relationship does get better for a person with this.
 
Lost love spells caster - love vashikaran specialist

Astrologer always prefers to suggest some powerful remedies those are worth to change things. It’s good and lot more people have seen that all the things getting well for them with this. Love Specialist Astrologer has made things better for them. There are lots of the situations where only some powerful astrological remedies do worth. So, chanting some spells and performing some easy rituals could help a person to make things well. There are many those who have seen the working of such spells. 

Love mantra expert astrologer 

When a person has start chanting some powerful spells they can surely make things better. They can make their life well and very soon a person is able to make their life well. When people get to Love vashikaran specialist they get to know about some powerful mantras which are worth. Very soon a person is able to see how the overall things get well for them. 

Lost love back astrology specialist has always made people to use vashikaran. This is the magic which is worth to use and people can see how it can bring love in their relationship.
So, in any situation taking help of an expert is always safe and worth. 

http://www.lovespecialistastrologer.com/
How I learned to stop worrying about the margins and love the gap
Tags: css, design, react, components
Published: 2021-05-04 15:51:11

We've all been in that situation where you're making a navbar or footer that contains multiple action components, like links and whatnot. You're going to need to add a little space between the items so often your first thought is to reach for margins.

```html
    <nav>
      <a href="#" class="button">Home</a>
      <a href="#" class="button">About</a>
      <a href="#" class="button">Portfolio</a>
      <a href="#" class="button">Contact</a>
    </nav>
```
```css
.button {
  margin-left: 10px;
}
```

You might even need a little pseudo style to leave the last item unaffected

```css
.button {
  margin-left: 10px;
}

.button:last-child {
  margin-left: 0;
}
```

Ever since the introduction of `gap` in css grids and shortly after flexbox, we can hoist this layout concern to the parent... where it should be:

```
nav {
  display: flex;
  gap: 10px;
}
```

{% codepen https://codepen.io/mattcoady/pen/gOmYxWz %}

Now `nav` takes full responsibly of the spacing and you can drop anything into the contents of nav, spaced out and ready to go. 

This technique is particularly useful in the world of reusable React components where a general use wrapper component can take any child component, render it and space it without the child component being concerned with its own layout.
A factory Design pattern with Js 
Tags: factorypattern
Published: 2021-05-04 15:16:11

A factory function is any function which is not a class or constructor that returns a (presumably new) object. In JavaScript, any function can return an object. When it does so without the new keyword, it’s a factory function.

Factory functions have always been attractive in JavaScript because they offer the ability to easily produce object instances without diving into the complexities of classes and the new keyword.


If you need to create many objects, you’ll want to combine the power of object literals and factory functions.

With a factory function, you can create as many user objects as you want.

If you’re building a chat app, for instance, you can have a user object representing the current user, and also a lot of other user objects representing all the other users who are currently signed in and chatting, so you can display their names and avatars, too .


by calling a factory method you avoid reallocating memory for each object you create, instead a factory method does that only once when it's called.




function Car(name, type) {

    this.name = name;
    this.type = type;
  
  }
  
  function Truck(name, type) {
  
    this.name = name;
    this.type = type;
  
  }


  function VehiclesFactoryMethod() {

    this.create = function(name, type) {
        switch(type) {
           case "Car":
             return new Car(name, type);
           case "Truck":
             return new Truck(name, type);
           
        }
    }
  
  }
  
  With our factory method in place, we are ready to use it for our object creation!
 Let's instantiate our factory method object.

const VehiclesFactoryMethod = new VehiclesFactoryMethod();
const vehicles = [];

  This array will simulate our Database for the purposes of this tutorial


 Let's fill our array with some vehicles!

vehicles.push(VehiclesFactoryMethod.create("Nissan", "Car"));
vehicles.push(VehiclesFactoryMethod.create("MAN", "Truck"));


This function will output the inserted vehicles in a more stylized context 

function print() {
    console.log("Database of our vehicles : ");
    console.log("Name: " + this.name);
    console.log("Type: " + this.type);
 }
 
 
 vehicles.forEach( vehicle => {
    print.call(vehicle);
 });
Beautify Laravel Route Views with Pretty Routes Package
Tags: webdev, laravel
Published: 2021-05-04 14:55:53

Are you also one of those people who are bored with the route: list display in your terminal? if so, then you are right to read this article. Maybe you can use this package to refresh your eyes while running or viewing the route list. How to use this package is also very easy, only a few commands you can see the results or the appearance of a more beautiful route list.

To make the route more beautiful, we can use the package from Wulfheart.

[Read more at codelapan.com](https://codelapan.com/post/mempercantik-tampilan-route-laravel-dengan-pretty-routes)
Added Password Validation in Laravel
Tags: webdev, laravel
Published: 2021-05-04 14:49:33

A few days ago Laravel officially updated the password validation, which means more and more options that we can use with extras such as mixedCase, which means that the password must consist of at least one uppercase and one lowercase letter. Letters which means the password must consist of at least one letter, numbers which means that the password must have at least one number, symbols which means that there must be at least one symbol in the password, and uncompromised which means that the passwork must not be compromised in the data leak.

[Read more at codelapan.com](https://codelapan.com/post/menambahkan-validasi-password-di-laravel)
MINMAX() Function in C
Published: 2021-05-04 14:48:34

MinMax method is used to find maximum and minimum (higher and lower) element in a list. Minmax method follows divide and conquer algorithm. 
Divide and Conquer Algorithm: 
Breaking a problem into sub problems until it gets simpler to solve and combine the solutions to get the solution for main problem. 
Minmax() function compares the values of two arguments passed into it and then returns the minimum and maximum among them that is smaller and larger between them. If both the values are equal then it returns make_pair(a,b). This function is also used to find the smallest and largest element in a list, then it returns the first one if there are more than one is the smallest element and the last one if there are more than one largest in the list.
Minmax() function compares the two values by binary function, which is defined by the user and then passed as an argument in std::minmax().

Parameters: a, b Values to compare. 

Comp accepts two values of type T as arguments, and returns a value convertible to bool. The function will not alter some of its arguments. This can be either a function pointer or a function object. 
For example:
#include<stdio.h>
using namespace std; 
int main () 
{ 
result = minmax({1,2,3,4,5}); 
cout << "minmax({1,2,3,4,5}): "; 
cout << result.first << ’ ’ << result.second << ‘\n’; 
return 0; 
} 
Output: 
minmax({1,2,3,4,5}): 1 5


C Program:

#include <stdio.h>
int main()
{
int arr1[100];
int i, mx, mn, n;
printf("\n\nFinding maximum and minimum element in an array :\n");
printf("Input the number of elements to be stored in the array :");
scanf("%d",&n);
printf("Input %d elements in the array :\n",n);
for(i=0;i<n;i++)
{
printf("element - %d : ",i);
scanf("%d",&arr1[i]);
}
mx = arr1[0];
mn = arr1[0];
for(i=1; i<n; i++)
{
if(arr1[i]>mx)
{
mx = arr1[i];
}
if(arr1[i]<mn)
{
mn = arr1[i];
}
}
printf("Maximum element is : %d\n", mx);
printf("Minimum element is : %d\n\n", mn);
}
OUTPUT:
Finding maximum and minimum element in an array :
Input the number of elements to be stored in the array :3
Input 3 elements in the array :
element - 0 : 12
element - 1 : 11
element - 2 : 15
Maximum element is : 15
Minimum element is : 11
Blockchain for Dummies
Tags: blockchain, cryptocurrency, bitcoin, ethereum
Published: 2021-05-04 14:47:32

If you are out on the internet recently, you must have heard of terms like "Blockchain" or "Cryptocurriencies". They have become quite the rage in the last few years. People are saying that it will change the world. But most of us don't really know or understand this blockchain or cryptocurrencies and why we should know about them. Let's try to understand it a little.

This article summarizes the most basic and important concepts needed to understand blockchain and its applications. So that you can participate in any conversation about this matter without getting lost in the first sentence.

## What Blockchain is NOT

Before we learn what is Blockchain, first we need to know what blockchain is not. 
- Blockchain is **NOT BITCOIN** 
- Blockchain is **NOT a cryptocurrency**

Now that we know what it is not, let's look into what it actually is.

## What is Blockchain?

Blockchain is the name of a whole new technology. As the name suggests it is a chain of blocks. Now, what are those blocks? These blocks are the transactions or the data stored on the blockchain. Each block is linked to two other blocks making a sequence of those blocks.

According to IBM, a pioneer in Blockchain and Tech Industry *"Blockchain is a shared, immutable ledger that facilitates the process of recording transactions and tracking assets in a business network."*

All the data in those blocks are visible to everyone in that blockchain. It is also immutable, meaning that once the data is entered into the blockchain it cannot be altered.

Now there are a lot more things that we need to know to understand how blockchain works, but we will not be looking into them in this article. I will be writing more articles on the blockchain which will dive into more detail.

## Why do we need Blockchain?

Whenever we do any type of transaction on the internet or use any service we need to be able to trust the other party that they will hold their word. To achieve that we have traditionally used middlemen, like banks, which facilitate those transactions. For years this method has worked really well but it has a lot of problems too. For example,
- They can be really slow
- They demand a fee to use their services
- We give them a lot of power and control over our lives
- They have full control over our data and can choose to do anything with it.

By using blockchain technology, we can eliminate a lot of those problems since it is not managed by any central authority but a group of people (everyone who uses it).

I will be writing a lot more articles about blockchain which will discuss the technologies in a lot more detail.
How to get started with MagicaVoxel and make your own avatar
Tags: tutorial, beginners, 3d, gamedev
Published: 2021-05-04 14:44:03

For some time, I have been using an open-source 3D tool called MagicaVoxel. If you have ever played or know about Minecraft, then it is a bit like that. This tool can help you get into 3D, create artwork or make your own avatar which the tutorial goes through below.

It is free to use for any project and relatively easy to get started with compared to other 3D software. The pre-set light and render settings really help. In other 3D programs you could tinker about for hours and it still does not even come close to decent. There are also fun lego, ball and clay settings where the building pieces, voxels, look like those.


## Get started you too
1. [Download the program from here](https://ephtracy.github.io/).
2. Install and open up the program.
3. You will see a blue box in the middle.
4. To your right, you should see a project panel.
5. Click on chr_sword and you will see a character with a sword in the main window.
6. On the left palette panel, choose the colour of your sweater.
7. On the brush panel, choose b for box mode and paint.
8. Then paint the sweater by clicking on the figure's sweater.
9. Keep going! Don't forget to save the file. Maybe erase some hair voxels or attach them to fit your shape.
10. Note that you are in Model mode. In the top left corner, you can switch to Render mode. The image renders every time you change something, you will see a blue loading bar at the top. When you are done you can save the image by clicking on the camera icon at the bottom. 

Good luck! //Julia in voxel form

![Person in voxel form](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qxsi6ao6vwganknv4vx4.png)

Post your avatar in the comments if you like :)
Clean up my git (Snack Pack #5)
Tags: webdev, github, git
Published: 2021-05-04 14:43:54

# Git Repo maintenance

If you've been working on any repo for an extended amount of time, you may have saved a million branches that have already been merged. It is time to clean all those old ones out. 

---

The commands we'll be using.

```
# Removes references from branches that are no longer on the origin
git remote prune origin
```

Note this next part will depend on your main branch's name. If you haven't yet, then you should rename `master` to `main`. See below for how to.

```
# Lists all the branches that have been merged into main and remove them
git branch --merged main | grep -v '^[ *]*main$' | xargs git branch -d
```

---

## Wrap it all up.
The last step is relatively easy. Combine it into your `.zshrc` or `.bashrc`. I'm sure there's a Windows and Linux equivalent, but I'm using macOS.
```
alias cleanUpMyGit="git remote prune origin ; git branch --merged master | grep -v '^[ *]*master$' | xargs git branch -d"
```

Go ahead and restart your terminal, then try it out in a repo directory. 

```
$ cleanUpMyGit
```

Afterward, you should see a list of the branches removed by the command. Happy Coding!

---

References: 
- <https://www.git-tower.com/learn/git/faq/git-rename-master-to-main/>
- <https://github.com/github/renaming>


My snack pack reads are intended for a quick read without any fluff and provide actionable items.
Getting My First Code Review
Tags: codenewbie, codereview, programming, webdev
Published: 2021-05-04 14:43:49

A few weeks ago I completed my first real project 🎉🤸🏾‍♀️  and couldn't have felt prouder of myself in that moment if I tried. That may sound like bragging, but if you're a new developer you know the endless tweaking, feelings of imposter syndrome and like you're not good enough because you know it's not "the best project ever". Yet, in your mind you *know* it's your best effort *right now* - at this point in time with your current knowledge. Eagerly I shared it with the community beaming with pride. Then after hitting the "Send" button I immediately started thinking about the criticisms my project would receive and how it would be torn down by all of these experienced developers. To my surprise (and relief) everyone congratulated me, said they liked it and gave great feedback 😌. I was even commended for having alt text for all the images and links. 

Then I had a 1 on 1 review with a senior developer, which I was nervous about and dreading 😰. Though in my head I was proud of myself, I kept thinking "They're not going to like it and pick it apart." Surprisingly they liked it and said I did a great job for my first attempt at a project 😌. It turned out to be a great discussion about the things I did well and the areas I can improve. Want to know the real kicker? I didn't realise it was a code review until *hours* after the call 😲. We were so busy discussing different coding and industry-related things that it just transitioned into my project, and we just talked away. What stood out to me when I realised it was, in fact, a code review was that the senior developer didn't approach it from a "This is right, this is wrong, know-it-all, I'm better than you" way. It didn't feel like a code review like the horror stories I've heard where the hard work of developers was torn down or not given constructive feedback. Needless to say I was on a high for a good week or two...or three 🙃  - and *still* proud of my first project, of course.

No matter how small or simple your idea is for building and cementing your knowledge on your coding journey, create that project. I've been building a list of project ideas to one day be able to create and let me tell you, they're all complex and I haven't the slightest clue where I would even start. However, I'll always remember being extremely proud of completing this first project and it'll be the first thing I talk about if asked "What have you built?" or "What was the first project you ever did?"

If you're curious, check out Coffee Heaven [here](https://github.com/debrakayeelliott/coffeeheaven) 🙂.
Linked List Data Structure Using Javascript
Tags: javascript, algorithms, beginners, productivity
Published: 2021-05-04 14:33:34

#Linked List

A Linked List is a linear data structure. The Linked List consisting of a group of nodes that together represent a sequence.

Linked List has behaved like each node contains a connection to another link or another node. also linked list is the most used data structure after the array.
1.Insert
2.Delete
3.Search
4.Null

####Insert :

The insert method is used for adding the data to the LinkedList.

#### Delete :

The delete is deleting the given node or element from the linked list.

#### Search :

A search returns a given node on the linked list.

#### Null :

if the next element is not having a data or node then this condition was true and return null.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iv4z8yoqfuhkgc4cl4t7.png)

This is how a linked list works the 1st is head and after I go for the next node or data if he doesn't get the next data then return null.

#### LinkedList example using Javascript :

```JS
class LinkedListNode{
    constructor(data){
        this.data = data;
        this.next = null;
        this.previous = null;
    }
}

class LinkedList{
    constructor(){
        this.head = null;
        this.tail = null;
        this.length = null;
    }

    insert(data){
        const node = new LinkedListNode(data);
       
        if(!this.head){
            this.head = node;
            this.tail = node;
        }
        else{
            this.tail.previous = node;
            this.tail.next = node;
            this.tail = node;
        }

        this.length +=1;
    }
}

const dataList = new LinkedList();

dataList.insert(10);
dataList.insert(34);
dataList.insert(53);
dataList.insert(45);

let currentNode = dataList.head;

for (let i = 0; i < dataList.length; i++) {
    console.log(currentNode.data);
    currentNode = currentNode.next;
}


console.log(JSON.stringify(dataList, null , 2));

```

#### Output :

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tbu8ycys7hn83qpxzwkt.png)

I hope you like this also comments about your thoughts.

For more content follow me on Instagram  [@developer_nikhil27](https://www.instagram.com/developer_nikhil27/).

If you want to more support me then buy me a [coffee](https://www.buymeacoffee.com/nikhilbobade27).

Thank you.