Skip to content

Instantly share code, notes, and snippets.

@clone1018
Created June 11, 2013 21:21
Show Gist options
  • Save clone1018/5760823 to your computer and use it in GitHub Desktop.
Save clone1018/5760823 to your computer and use it in GitHub Desktop.
<?php
namespace CFS;
use Eloquent;
class File extends Eloquent {
protected $table = 'cfs_files';
protected $guarded = array('id');
protected $hidden = array('id');
protected $touches = array('folder');
public function folder() {
return $this->belongsTo('CFS\Folder');
}
// ...
}
<?php
namespace CFS;
use Eloquent;
class Folder extends Eloquent {
protected $table = 'cfs_folders';
protected $guarded = array('id');
public function files() {
return $this->hasMany('CFS\File', 'folder_id');
}
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment