-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* just check that test is failing for Laravel 8 * Publish seeders in the right folder and add namespace if Laravel 8 or greater Removed Process and use Composer * changed seedable * fixed dummydatabaseseeder * Check if class is namespaced * fix StyleCI * Fixed seeders not autoloading in tests * revert composer changes run autoload from app * Centralized getSeedsFolderName * removed use * Remove duplication calling addNamespaceIfNeeded * Move method to helper class Co-authored-by: Christoph Schweppe <info@cschweppe.de>
- Loading branch information
Showing
8 changed files
with
141 additions
and
46 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 |
---|---|---|
@@ -1,28 +1,25 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Seeder; | ||
use TCG\Voyager\Traits\Seedable; | ||
|
||
class VoyagerDatabaseSeeder extends Seeder | ||
{ | ||
use Seedable; | ||
|
||
protected $seedersPath = __DIR__.'/'; | ||
|
||
/** | ||
* Run the database seeds. | ||
* | ||
* @return void | ||
*/ | ||
public function run() | ||
{ | ||
$this->seed('DataTypesTableSeeder'); | ||
$this->seed('DataRowsTableSeeder'); | ||
$this->seed('MenusTableSeeder'); | ||
$this->seed('MenuItemsTableSeeder'); | ||
$this->seed('RolesTableSeeder'); | ||
$this->seed('PermissionsTableSeeder'); | ||
$this->seed('PermissionRoleTableSeeder'); | ||
$this->seed('SettingsTableSeeder'); | ||
$this->call([ | ||
DataTypesTableSeeder::class, | ||
DataRowsTableSeeder::class, | ||
MenusTableSeeder::class, | ||
MenuItemsTableSeeder::class, | ||
RolesTableSeeder::class, | ||
PermissionsTableSeeder::class, | ||
PermissionRoleTableSeeder::class, | ||
SettingsTableSeeder::class, | ||
]); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,27 +1,23 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Seeder; | ||
use TCG\Voyager\Traits\Seedable; | ||
|
||
class VoyagerDummyDatabaseSeeder extends Seeder | ||
{ | ||
use Seedable; | ||
|
||
protected $seedersPath; | ||
|
||
/** | ||
* Run the database seeds. | ||
* | ||
* @return void | ||
*/ | ||
public function run() | ||
{ | ||
$this->seedersPath = database_path('seeds').'/'; | ||
$this->seed('CategoriesTableSeeder'); | ||
$this->seed('UsersTableSeeder'); | ||
$this->seed('PostsTableSeeder'); | ||
$this->seed('PagesTableSeeder'); | ||
$this->seed('TranslationsTableSeeder'); | ||
$this->seed('PermissionRoleTableSeeder'); | ||
$this->call([ | ||
CategoriesTableSeeder::class, | ||
UsersTableSeeder::class, | ||
PostsTableSeeder::class, | ||
PagesTableSeeder::class, | ||
TranslationsTableSeeder::class, | ||
PermissionRoleTableSeeder::class, | ||
]); | ||
} | ||
} |
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
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,11 @@ | ||
<?php | ||
|
||
namespace TCG\Voyager; | ||
|
||
class Seed | ||
{ | ||
public static function getFolderName() | ||
{ | ||
return version_compare(app()->version(), '8.0') >= 0 ? 'seeders' : 'seeds'; | ||
} | ||
} |
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,30 @@ | ||
<?php | ||
|
||
namespace TCG\Voyager\Tests\Feature; | ||
|
||
use TCG\Voyager\Tests\TestCase; | ||
|
||
class SeederTest extends TestCase | ||
{ | ||
public function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->install(); | ||
} | ||
|
||
/** | ||
* Test manually seeding is working. | ||
*/ | ||
public function testVoyagerDatabaseSeederCanBeCalled() | ||
{ | ||
$exception = null; | ||
|
||
try { | ||
$this->artisan('db:seed', ['--class' => 'VoyagerDatabaseSeeder']); | ||
} catch (\Exception $exception) { | ||
} | ||
|
||
$this->assertNull($exception, 'An exception was thrown'); | ||
} | ||
} |
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