File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed
Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -68,8 +68,11 @@ abstract class FMModel extends Model
6868
6969 public function __construct (array $ attributes = [])
7070 {
71- // FileMaker users tables, but the connections use layouts, so we'll use that as a standard
72- $ this ->setTable ($ this ->layout ?? $ this ->table );
71+ // Laravel uses tables normally, but FileMaker users layouts, so we'll let users set either one for clarity
72+ // Set table if the user didn't set it and set $layout instead
73+ if (!$ this ->table ){
74+ $ this ->setTable ($ this ->layout );
75+ }
7376 parent ::__construct ($ attributes );
7477 }
7578
@@ -408,7 +411,7 @@ public function getContainersToWrite(){
408411 */
409412 public function getTable ()
410413 {
411- return $ this ->layout ?? $ this ->table ?? Str::snake (Str::pluralStudly (class_basename ($ this )));
414+ return $ this ->table ?? $ this ->layout ?? Str::snake (Str::pluralStudly (class_basename ($ this )));
412415 }
413416
414417 /**
@@ -478,4 +481,17 @@ public function setAttribute($key, $value)
478481 }
479482
480483
484+ /**
485+ * Qualify the given column name by the model's table.
486+ *
487+ * @param string $column
488+ * @return string
489+ */
490+ public function qualifyColumn ($ column )
491+ {
492+ // we shouldn't ever qualify columns because they could be related data
493+ // so just return without the table
494+ return $ column ;
495+ }
496+
481497}
You can’t perform that action at this time.
0 commit comments