Skip to content

Instantly share code, notes, and snippets.

@JesseObrien
Created June 4, 2014 18:54
Show Gist options
  • Save JesseObrien/2732e45340348b563f21 to your computer and use it in GitHub Desktop.
Save JesseObrien/2732e45340348b563f21 to your computer and use it in GitHub Desktop.
Add soft delete traits to every PHP file in a directory.
#!/usr/bin/env bash
sed -i 's/<?php\(.*\)/<?php\1\n\nuse Illuminate\Database\Eloquent\SoftDeletingTrait;/' *.php
sed -i 's/class \(.*\) {/class \1 {\n\n\tuse SoftDeletingTrait;/' *.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment