Skip to content

Instantly share code, notes, and snippets.

View Escarter's full-sized avatar
🏠
Working from home

Mbutuh Escarter Brieno Escarter

🏠
Working from home
  • Douala, Cameroon
View GitHub Profile
@XenitXTD
XenitXTD / Laravel_Homestead_Oracle after.sh automation of OCI8 Setup
Last active October 11, 2022 19:59
This was an automation configured on the laravel homestead vagrant VM to automate the setup and configuration of the Oracle OCI8 php .so file and installation of the oracle client so that you are able to connect to an oracle database using the Yajra oracle package for laravel, using the homestead after.sh file to setup the required installers et…
#!/bin/sh
# If you would like to do some extra provisioning you may
# add any commands you wish to this file and they will
# be run after the Homestead machine is provisioned.
apt-get update
# if not installed install it
apt-get install unzip
@andrewtkemp
andrewtkemp / group-github-guide.md
Created April 14, 2016 17:12
This is a very basic guide on how to start working on group projects at DevMountain with GitHub.

Simple Group Project Starting Guide for GitHub (DevMountain)

Geordyn Ader - Mentor - Dallas, TX Campus

Getting Started - Choose ONE person from your group to take care of the following steps

  1. Go to GitHub and click the + in the top right corner. Click New Organization.
  2. Give it a name - should relate to your project, obviously.
  3. Add email for ‘billing’ - do not worry, it’s free
  4. Choose the Free Plan
  5. It’ll take you to a new page. Now add everyone in your team onto the group (including your mentor)
@alesf
alesf / blog.md
Last active September 16, 2023 07:28
Laravel - Eloquent: Cascading delete, forceDelete and restore

If you want to delete a model with related models you can use Laravel model events. There is also a special case if your models cascade.

Lets say you have Folder and File Eloquent models that are related and use SoftDeletes trait and when you delete a folder you also want to delete files in folder and all subfolders with files.

In the boot method or Folder model you catch delete and restore events (actually deleting and restoring events that trigger before restoring or deleting happens). You can delete/restore all files in folder you're deleting/restoring with $folder->files()->delete(); and $folder->files()->withTrashed()->restore();.

Folders on the other hand cascade (folder in a folder in a folder) and because events do not trigger if you don't pull the models (->get() method), the model events won't trigger for subfolders. That's why you need to pull the folders and iterate trough them (->each() method) and delete/restore them.

You could use database CASCADE feature but that does