File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -31,17 +31,11 @@ class Model extends EloquentModel
3131 public const PUBLIC_ID_COLUMN = 'public_id ' ;
3232
3333 /**
34- * Create a new instance of the model.
35- *
36- * @param array $attributes the attributes to set on the model
37- *
38- * @return void
34+ * Get the correct current connection to use.
3935 */
40- public function __construct ( array $ attributes = [] )
36+ public function getConnectionName ( )
4137 {
42- parent ::__construct ($ attributes );
43-
44- $ this ->connection = config ('fleetbase.connection.db ' , 'mysql ' );
38+ return $ this ->connection ?: config ('fleetbase.connection.db ' , 'mysql ' );
4539 }
4640
4741 /**
Original file line number Diff line number Diff line change @@ -21,17 +21,13 @@ class Setting extends EloquentModel
2121 use Filterable;
2222
2323 /**
24- * Create a new instance of the model.
25- *
26- * @param array $attributes the attributes to set on the model
27- *
28- * @return void
24+ * Get the correct current connection to use.
25+ * NOTE FOR LATER: Perhaps system level settings should always write to main connection,
26+ * but allow organization level settings to write to sandbox connection.
2927 */
30- public function __construct ( array $ attributes = [] )
28+ public function getConnectionName ( )
3129 {
32- parent ::__construct ($ attributes );
33-
34- $ this ->connection = config ('fleetbase.connection.db ' , 'mysql ' );
30+ return $ this ->connection ?: config ('fleetbase.connection.db ' , 'mysql ' );
3531 }
3632
3733 /**
You can’t perform that action at this time.
0 commit comments