-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add some mising models, factories, and seeders
- Loading branch information
Showing
6 changed files
with
124 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace App\Models; | ||
|
||
use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Institution extends Model { | ||
use HasFactory; | ||
|
||
protected $primaryKey = 'iid'; | ||
|
||
// TODO (Logan) fix typo in legacy create timestamp | ||
const CREATED_AT = 'IntialTimeStamp'; | ||
const UPDATED_AT = 'modifiedTimeStamp'; | ||
|
||
protected $fillable = [ | ||
'institutionID', | ||
'InstitutionCode', | ||
'InstitutionName', | ||
'InstitutionName2', | ||
'Address1', | ||
'Address2', | ||
'City', | ||
'StateProvince', | ||
'PostalCode', | ||
'Country', | ||
'Phone', | ||
'Contact', | ||
'Email', | ||
'Url', | ||
'Notes', | ||
'modifieduid', | ||
'modifiedTimeStamp', | ||
'IntialTimeStamp', | ||
]; | ||
|
||
public function collections() { | ||
return $this->hasMany(Collections::class, 'collid', 'collid'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace Database\Factories; | ||
|
||
use App\Models\Collection; | ||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
|
||
/** | ||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Collection> | ||
*/ | ||
class CollectionFactory extends Factory { | ||
protected $model = Collection::class; | ||
/** | ||
* Define the model's default state. | ||
* | ||
* @return array<string, mixed> | ||
*/ | ||
public function definition(): array { | ||
return [ | ||
'institutionCode' => null, | ||
'iid' => null, | ||
'collectionName' => fake()->name() . ' Collection', | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace Database\Factories; | ||
|
||
use App\Models\Institution; | ||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
use Illuminate\Support\Str; | ||
|
||
/** | ||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Institution> | ||
*/ | ||
class InstitutionFactory extends Factory { | ||
|
||
protected $model = Institution::class; | ||
/** | ||
* Define the model's default state. | ||
* | ||
* @return array<string, mixed> | ||
*/ | ||
public function definition(): array { | ||
return [ | ||
'InstitutionCode' => Str::random(4), | ||
'InstitutionName' => fake()->name(), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace Database\Factories; | ||
|
||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
use App\Models\Occurrence; | ||
|
||
/** | ||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Occurrence> | ||
*/ | ||
class OccurrenceFactory extends Factory { | ||
protected $model = Occurrence::class; | ||
/** | ||
* Define the model's default state. | ||
* | ||
* @return array<string, mixed> | ||
*/ | ||
public function definition(): array { | ||
return [ | ||
//This is required and must be passed in | ||
'collid' => null, | ||
'locality' => fake()->country(), | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters