teleren/devto huggingface dataset:
How To Move Record From One Table To Another In Laravel
Tags: laravel, php, tips, code
Published: 2020-08-03 17:38:05

Laravel does not have any direct method to move an entire record from one table to another. It can be done indirectly. Let's see one of the ways here in this article.

Laravel has a supporting feature for **replicating** or **copying** an entire **row** with the power of `Model` in an optimized manner.

Laravel has an inbuilt method `replicate()` of **Model** that can be used to prepare an entirely new, non-existing cloned instance of a model.

The `save()` method will store this new clone model into the database.

Tested with Laravel version **6** and **7**.

Kindly check for your version on the official DOC for [Replicating Models](https://laravel.com/docs/7.x/eloquent#replicating-models). This link will take you to **Laravel 7 Documentation**.

### Example

- In this example, assuming a use case where we want to move all those users whose last log is more than 3 years. Assuming these users as **Inactive users**.
- We will follow the below steps:
  1. Create a new instance with **`replicate()`** method based on the old or original record.
  2. Store this new instance with **`save()`** method and **`setTable()`** method in new table.
  3. Delete the old record from the **original** table with **`delete()`** method of a model.

```php
  Users::query()
  ->where('last_login','>', now()->subYears(3))
  ->each(function ($oldRecord) {
    $newRecord = $oldRecord->replicate();
    $newRecord->setTable('inactive_users');
    $newRecord->save();

    $oldRecord->delete();
  });
```

This will move all records from **`users`** table to **`inactive_users`** who has not sign in into last 3 years

We also came across this query raised by the developer at Laracast forum and [reply](https://laracasts.com/discuss/channels/laravel/how-best-to-copy-a-row-of-data-from-one-table-to-another?reply=586031) worth checking by [willsmanley](https://laracasts.com/@willsmanley).

Read the complete post on our site [MeshWorld](https://meshworld.in) - [Move Record From One Table To Another In Laravel](https://meshworld.in/move-record-from-one-table-to-another-in-laravel/)

Read others post on our site [MeshWorld](https://meshworld.in)

### Resources
- [Laravel Replicating Models](https://laravel.com/docs/7.x/eloquent#replicating-models)
- [How best to copy a row of data from one table to another](https://laracasts.com/discuss/channels/laravel/how-best-to-copy-a-row-of-data-from-one-table-to-another)

Happy 😄 coding

With ❤️ from 🇮🇳
Learning With Video Games
Tags: games, learning, tutorials
Published: 2020-08-03 17:31:15

---
title: Learning With Video Games
published: true
description: 
tags: games, learning, tutorials,
//cover_image: https://direct_url_to_image.jpg
---

I just recently finished [Service Workies](https://serviceworkies.com/) by [Dave Geddes](https://twitter.com/geddski).  It is a video game style tutorial that teaches the player how to use Service Workers.  It's not simply the gamification of learning, but an actual game with engaging graphics, music and story.

![Service Workies Screen](https://dev-to-uploads.s3.amazonaws.com/i/ykkblygwuprgv4di7rk7.png)

The concept is based on the idea that expertise is attained when you repeatedly do something.  Video games are a good example of this and he uses those techniques to solidify concepts and drill in practice.  Although I'm not really a gamer, I find this style of tutorials to be really creative and fun!

Dave Geddes also have "courses" on [Flexbox](https://flexboxzombies.com/p/flexbox-zombies) and [CSS Grid](https://gridcritters.com/).  Both Flexbox Zombies and Service Workies are free to play where Grid Critters cost about $99 at the time of writing this.

After a quick look around, I've found a few other games in the same vein:

[Flexbox Froggie](https://flexboxfroggy.com/)
[Grid Garden](https://cssgridgarden.com/)
[CSS Diner](https://flukeout.github.io/)
[VIM Adventures](https://vim-adventures.com/)

What's your experience with these type of games?  Do you think they are an effective way of learning?
This Angular helper function has saved me from memory leaks for 4 years
Tags: angular
Published: 2020-08-03 17:30:34

I have been working with Angular for more than 4 years now. From Angular 2 to Angular 10, this helper function has followed me everywhere:

```ts
export function unsubscribe(subscription: Subscription | Subscription[]) {
  const subscriptions = Array.isArray(subscription) ? subscription : [subscription];
  subscriptions.forEach(s => {
    if (s && !s.closed) {
      s.unsubscribe();
    }
  });
}
```

and here's how to use it:

```ts
@Component({
  selector: 'my-component',
  template: `
    <div>
      {{counter}}
    </div>
  `
})
export class MyComponent implements OnInit, OnDestroy {
  
  private subscriptions = [];
  
  counter = 0;

  ngOnInit() {
    this.subscriptions.push(
      // memory leak ahead !
      timer(0, 1000)
        .subscribe(() => this.counter++),
    );
  }

  ngOnDestroy(): void {
    unsubscribe(this.subscriptions);
  }
  
}
```

Now, when your component is destroyed, you are safe from memory leaks as you have properly unsubscribed from the RxJS observable.
Gitea and Drone CI lovers, this is for you
Tags: productivity, devops, gitea, droneci
Published: 2020-08-03 17:05:21

You love Gitea and we do too ! This weekend, we've added Gitea support to [Pmbot](https://pmbot.io). You will now be able to do automated dependency updates of your Gitea projects using DroneCI.

We've written a blog post for you to get started ! Check it out at https://blog.pmbot.io/announcing-support-for-gitea/

Our your deps up to date ?
Scroll snap - one at a time
Tags: help, css, javascript
Published: 2020-08-03 17:02:48

I have this sandbox here, it's an implimentation of two off canvas menus left and right, it's meant to feel native on a mobile by allowing you to drag across to reveal a menu. For the most part it's working well, not a lot of JavaScript is used and the idea isn't really complex which is nice because this sort of thing used to be a real pain.

{% codesandbox lztrl %}

What I am wondering is how can I force it to scroll one at a time either in js or css. You can over scroll from one side to another with a little force. I want to swipe hard and always arrive in the middle the swipe again to open the other menu.

The sandbox probably doesn't work in this embedded frame so you might have to view the code.
How To Reset An HTML Form With JavaScript
Tags: javascript, html, form
Published: 2020-08-03 17:00:45

With HTML, a reset button can be added in a form with `<input />` tag. For that, we need to specify attribute `type` with `"reset"` value as `type="reset"`

```html
<input type="reset" value="Reset" />
```

And when the user clicks on the `Reset` button, the form that it belongs to will reset to its original state.

This can also be done with JavaScript by using `reset()` method.

In this tutorial, we'll see how to reset an HTML form with JavaScript.

### Example

- Assume that we have an E-commerce website containing login and registration form on the same page like Facebook.
- An HTML form for registration with id `registrationForm` which will be used by a new customer coming to our website.

```html
<form action="https://example.com/registration" method="post" id="registrationForm">
  <!-- .... -->
</form>
```

So in order to reset this form we will use JavaScript `reset()` method.

```javascript
const registrationForm = document.getElementById("registrationForm");
registrationForm.reset();
```

This will restore the form to its original state by clearing all the form elements.

Read the complete post on our site [MeshWorld](https://meshworld.in) - [Reset An HTML Form With JavaScript](https://meshworld.in/reset-an-html-form-with-javascript/)

Read others post on our site [MeshWorld](https://meshworld.in)

> “Talk is cheap. Show me the code.”
> <br/> ~ Linus Torvalds

Happy 😄 coding

With ❤️ from 🇮🇳
What is the first thing you do when setting up a new computer?
Tags: discuss
Published: 2020-08-03 16:56:53

---
title: What is the first thing you do when setting up a new computer?
published: true
description: Do you have any rituals?  Programs to install?  Shortcuts to set up? 
tags: discuss
//cover_image: https://direct_url_to_image.jpg
---

When you get a new computer, what are the first things you do?  Whether it's:
- Installing programs
- Adding shortcuts
- Disabling certain options
- Setting up new preferences
- Etc.

I'm eager to hear what you'd consider the must-do "first steps" for a new machine.
Deployment of smart contract 
Tags: remix, solidity, ethereum, blockchain
Published: 2020-08-03 16:48:56

Greetings!

I am working on a web based DApp.

my question is, everytime when I have to work on project I am deploying a smart contract on remix & each time the variables of smart contract gets back to initial state which is technically correct as I am deploying again and again. 
but as a product it must preserve its state so, how can that be done?? can it be resolved with truffle and ganache??
Beautiful Social Media icons with Hover Animation using HTML and CSS
Tags: css, beginners, tutorial, design
Published: 2020-08-03 16:46:07

{% youtube HJs-JdmCDsA %}

In this Tutorial, we'll build a Beautiful Social Media icons with Hover Animation using HTML and CSS. This Project-based Tutorial is suitable for all especially Beginners.

📕 Images download link:  https://drive.google.com/drive/folders/1WErxy_SOmFL8CZg1BWIQP8ped5As2vV-?usp=sharing

🧠 Concepts covered in this video:
 - Modern Web Design
 - Flexbox
 - Animations 
 - CSS transitions
 - Transforms

If you are interested in more real-world **project-based tutorials** then consider checking out the [**Code League**](https://www.youtube.com/channel/UCBF2LIwr2Odb3-pRnNBRegA) Youtube channel and inspire the tech industry.

Share this [video](https://youtu.be/HJs-JdmCDsA) with a friend

Let’s connect:
[Twitter](https://www.twitter.com/codeleague7) 
[Instagram](https://www.instagram.com/codeleague7)
HTML to Angular/React app in single command
Tags: html, angular, react, cli
Published: 2020-08-03 16:24:07

Having a large chunk of HTML and want to convert it to app?

Just augment it with *data-component* attribute and run a single cli command:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/kru7mdwlr365wyst6cl5.gif)

For Angular ([link](https://github.com/obenjiro/create-angular-components))

```
npx create-angular-components ./index.html
```

For React ([link](https://github.com/roman01la/html-to-react-components))

```
npx html-to-react-components ./index.html
```

🧙🏻‍♂️ Magic :)
Day 1 of dirty 30
Tags: mit
Published: 2020-08-03 16:18:59

Woahwoahwoah now is it my fault that I didn't know what was going on. Hey  still trying to figour out how you guys know like was there cameras in my car or something.lol. I'm like still lost. But aye that's what makes the show. So today is day1 of chap 30. Stay tuned frfr. Cause the show is gone be to hot for tv. Bring on the tea and money😜🤫😈😈👿👿🙈🙉🙊
How to install Chrome extensions manually from GitHub
Tags: github, chrome, webdev, javascript
Published: 2020-08-03 16:16:41

Installing Chrome extensions manually from GitHub is a great way to pass around extensions if they are a work-in-progress or otherwise don't need to be in the Chrome store.

Here are the three steps to make it happen.

## 1. Clone Repo or Download Zip

![GitHub Zip](https://dev-to-uploads.s3.amazonaws.com/i/0mepmnsme5n2ladav5mp.png)

Use either technique to get the folder onto your local machine. Use whichever technique fits your workflow and comfort level.

If you clone or fork the repo, you'll only have to `git pull` every time you want changes. You will still have to manually "refresh" the extension to see the changes, explained later.

## 2. Visit `chrome://extensions/` and turn on "Developer mode"

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/34fjjva60v7t8wmamwxp.png)

## 3. Click "Load unpacked" button and navivigate to the folder you downloaded from GitHub

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

## That's it 🎉

If you pull down new changes or make a change to the extension's files locally, you'll need to hit the "refresh" icon in `chrome://extensions/` in order to run the new functionality...

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

***

You do not have to understand how to develop Chrome extensions in order to download and use one, but if you are interested in getting started, here is a nice post...

{% link https://dev.to/michaeldscherr/building-a-simple-chrome-extension-1mal %}

For more info on working with Chrome extensions in general, [search DEV for "chrome extension"](https://dev.to/search?q=chrome%20extension) and find _a lot_ of great resources. 😄
codewar day3
Tags: javascript, node, challenge, 100daysofcode
Published: 2020-08-03 16:07:39

today the problem like this : 
Your task is to make a function that can take any non-negative integer as a argument and return it with its digits in descending order. Essentially, rearrange the digits to create the highest possible number.

Examples:
Input: 42145 Output: 54421

Input: 145263 Output: 654321

Input: 123456789 Output: 987654321

then my solve : 

```javascript
const sortnumber = n => {
  let data = parseInt(
    n
      .toString()
      .split("")
      .sort()
      .reverse()
      .join()
      .replace(/,/g, "")
  );
  return data;
};
```
i use some string, number and array prototype i learn a lot from developer.mozilla.org
i learning how the faster solve the problem, solve it with 'logic', then find how to cooding it :)
thanks codewar and mozilla developer

anyway other sorter solving like this 
```javascript 
function descendingOrder(n){
  return +(n+'').split('').sort().reverse().join('')
}
```
Acknowledgement From Recorded Future
Tags: security, bugbounty, bughunting, cybersecurity
Published: 2020-08-03 15:48:39

Cyber Security Rehearsing is going great. I cherish programming and afterwards the Vulnerabilities that stand because of the low level of Programming.

Same Issue I have found on[ Recorded Future's](https://www.recordedfuture.com/) site. The defects I have found are **Email Spoofing** and **Clickjacking** and the site is responsible of their Security issues, I informed all of them and the following one day I got a thanks answer from them, In one week they settled this issue.

They offer Acknowledgements to me furthermore included my name in their site's[ Hall Of Fame](https://www.recordedfuture.com/security/).

See below Proof of concept.

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

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

Thanks to[ Recorded Future](https://www.recordedfuture.com) for giving me Acknowledgement.
Acknowledgement From KNB
Tags: security, bugbounty, bughunting, cybersecurity
Published: 2020-08-03 15:48:37

In the wake of burning through many hours in Cyber Security Researching about I am presently ready to create some logical defects in Web Applications, before some days I was testing the site of [KNB](https://www.knb.nl) I have established some basic and minor issues related with the security of their site.

I have established **Clickjacking**,** XSS (Cross-site scripting)** and some different issues related with their site.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/6ea7mlb02m7mf5s5yq1s.png)

In the wake of discovering Reflected base XSS in their site, I am able to change this Reflected XSS into Stored XSS and it would be significantly more Malicious. I also founded the issue of Missing DMARC records and other Clickjacking issues. After my reports to [KNB](https://www.knb.nl) I receive a positive reply from the company.

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

As indicated by their[ Responsible Disclosure](https://www.knb.nl/english/responsible-disclosure) they accepted my report and Acknowledged me. They additionally included my name in their website's [Responsible Disclosure](https://www.knb.nl/english/responsible-disclosure)'s[ Hall of Fame](https://www.knb.nl/responsible-disclosure-hall-of-fame) page.

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

I am appreciative to group KNB to accept these issues and attempt to fix them. Thank You!
Acknowledgement From Intel
Tags: security, bugbounty, bughunting, cybersecurity
Published: 2020-08-03 15:48:35

Before some days I have established a logical security issue in Intel's website however they have some different Responsible policy, they don't permit Researchers to do pen-testing without their authorization else they may take actions against it. So I contacted them and requested permission which they agreed and in a few days I reported them that issue and it got approved.

After working on my report, in a few days, they Acknowledged me with the Certificate and the security team is working to resolve this issue.

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

{% youtube ZzQY55Jl6ns %}

Thankful for your valuable time.
Acknowledgement From Inflectra
Tags: security, bugbounty, bughunting, cybersecurity
Published: 2020-08-03 15:48:33

As **Cross-Site Scripting** is one of my most loved imperfections I frequently test in web application and the greater part of the circumstances I got my outcome. Same issue I have recently found in[ Inflectra](https://www.inflectra.com)  with the assistance of one of my companions.

Most of the time Cross-Site Scripting vulnerabilities exist in Forms, Search Results, Support and Forms fields. I have likewise established the Stored XSS in the Support[ Help Center of Inflectra](https://www.inflectra.com/Support/Forum/List.aspx).

**Vulnerable Url:** [https://www.inflectra.com/Support/Forum/List.aspx](https://www.inflectra.com/Support/Forum/List.aspx)

**User Agent:** Mozilla / Chrome / Safari / Android

**Bug Type:** Stored XSS (Cross-Site Scripting)

**Fix:** Modify your input validation.

**Date:** 6th Feb - 17

**Current Status:** Patched

**Steps To Produce:**

1. Goto[ https://www.inflectra.com/Support/Forums.aspx](https://www.inflectra.com/Support/Forums.aspx)
2. In the Forms, field selects any Category and after that select any problem/question.
3. Click on the Reply Button on that question and here select **Insert Table** option.
4. Insert[ XSS (Cross-Site Scripting) Payload](http://www.muhaddis.info/advanced-cross-site-scripting-xss-cheat-sheet/) in every single table field as appeared in the picture. Then click **Insert Table.** Payload ">&lt;img src=# onerror=alert('XSS') /> You'll see the popup executes and the page is powerless against XSS.

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

At that point as I **Inserted Table** the code is executed and a popup shows up.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/6d0kpbgxwp57ynkgd7m1.png)

As I got the outcomes I reported this Security blemish to them they answered me in five working days and began attempting to resolve this issue.

They settled this issue in fifteen days and offered me to mention my name in their web site security  [Hall of Fame](https://www.inflectra.com/Company/Responsible-Disclosure.aspx) page.

I accepted their offer and in five more days I was on their[ Hall of Fame](https://www.inflectra.com/Company/Responsible-Disclosure.aspx) page.

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

Much Obliged for taking your valuable time. Much Obliged Inflectra for acknowledgement. (:
Acknowledgement From Jet
Tags: security, bugbounty, bughunting, cybersecurity
Published: 2020-08-03 15:48:28

On third March 2017, I visited[ Jet.Com](http://Jet.com) and by investing a modest measure of energy I discovered a famous vulnerability in their site. It was considered as a Cookie Replay issue that leads to lifetime access of the victim's account. In case you're a security analyst or a bug researcher I generally exhort you to invest as much time in chasing as much you can, and that I learnt from one of my Indian friends.


## **Steps to Replication**:
1. Goto[ Jet's Account](https://jet.com/account/)
2. Login to Your Account
3. Get the Cookies using " Burp Suite" or "EditThisCookie" or (AnyBrowser's Extension) Copy All These Cookies.
4. Logout from the Account
5. Clear All the Cookies of your Browser related with[ Jet's Account](https://jet.com/account/)
6. Save the Cookies you Copied in a Text File
7. Now Inject/Import Old Cookies to the[ Jet's Account](https://jet.com/account/) by "EditThisCookie" (Google Extension)
8. As you can see, You will be again logged In to[ Jet's Account](https://jet.com/account/) Account using old Session Cookies.

After identifying that report they changed the to triaged and I’m glad to get another bounty, but then they revoked and I was like :|

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/rozkiljadwgymzacxlao.jpg)

Following two days the report status changed to duplicate and resolved.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/a8kplntd9dpe81sytaqs.jpg)

They recognized me by including my name in their Security researcher[ Hall of fame](https://bugcrowd.com/jet/hall-of-fame).

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/3okh6yvw8wo3j7mxuf03.png)

I'll test that site again as I got some time and I'll do my best to locate another interesting vulnerability. I thank Jet for acknowledgement and my thanks to you too for your profitable time.
Acknowledgement From Unsplash
Tags: security, bugbounty, bughunting, cybersecurity
Published: 2020-08-03 15:48:22

Who don't love complimentary gifts regardless of how much cash you have? One advantage for me after getting involved in Bug Bounties is I love particular organization Shirts, Swags and stickers and now I have a bunch of collections. I frequently called myself freebies hunter rather than Bug Bounty Hunter :P

Well in my social circles a person posted a photo of his lid back with a stuck couple of stickers and unsplash stickers was additionally a piece of that accumulation. I went to their site and found that it's a website dedicated to sharing copyright-free photography under the Unsplash license. I founded the best room for me. I established the best space for me.

At the time I don't know whether they have a responsible disclosure policy or not. Without sitting idle and looking for any security policy page, I registered myself here and began pentesting not for bounty hunting but for bug freebies reward hunting. I know it sounds unfathomably horrendous. After searching and looking into pages I discovered a[ security](https://unsplash.com/security) and it initiates my inner monster of Bug Hunting, just joking.

I was searching for security-related issues, I experienced their API documentation and discovered many intriguing things here.

In a couple of hours, I established three security vulnerabilities in their Web Application and one in their APIs which can disclose private and delicate data.

I reported these security vulnerabilities to their security team with detail explained and got responses from them in the next couple of hours.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/vy7q8ticsxkqzxw18iy9.jpg)

Because of their security policy, I can't uncover finished bug reports with Proof of Concept. After addressing these security discoveries, Unsplash Co-founder & CPO recommended me on [LinkedIn.](http://linkedin.com/in/MuhaddiMu)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/h9jrjlxpxfmdmd7mxozl.jpg)

They will be adding me in their[ security](https://unsplash.com/security) page soon. It was truly a good experience with Unsplash and I truly appreciate their support team. A debt of gratitude is in order for pursuing. Keep in contact to pursue more nitty-gritty reviews on bug bounty and more identified with InfoSec.