File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " fleetbase/core-api" ,
3- "version" : " 1.6.46 " ,
3+ "version" : " 1.6.47 " ,
44 "description" : " Core Framework and Resources for Fleetbase API" ,
55 "keywords" : [
66 " fleetbase" ,
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Fleetbase \Seeders \Concerns ;
4+
5+ use Fleetbase \Models \Company ;
6+
7+ trait ResolvesSeedCompany
8+ {
9+ protected function resolveSeedCompany (?string $ fallbackUuidEnv = null , ?string $ fallbackPublicIdEnv = null ): ?Company
10+ {
11+ $ companyUuid = env ('SEED_COMPANY_UUID ' ) ?: ($ fallbackUuidEnv ? env ($ fallbackUuidEnv ) : null );
12+ $ companyPublicId = env ('SEED_COMPANY_PUBLIC_ID ' ) ?: ($ fallbackPublicIdEnv ? env ($ fallbackPublicIdEnv ) : null );
13+
14+ if ($ companyUuid ) {
15+ return Company::where ('uuid ' , $ companyUuid )->first ();
16+ }
17+
18+ if ($ companyPublicId ) {
19+ return Company::where ('public_id ' , $ companyPublicId )->first ();
20+ }
21+
22+ return Company::query ()->orderBy ('created_at ' )->first ();
23+ }
24+ }
You can’t perform that action at this time.
0 commit comments