An artisan `make:crud` command to create a simple CRUD feature on your Laravel 5.5 application.
An artisan `make:crud` command to create a simple CRUD feature on your Laravel 5.3, 5.4, and 5.5 application.
## About this package
With this package installed on local environment, we can use (e.g.) `php artisan make:crud Vehicle` command to generate some files :
@ -24,7 +24,7 @@ It will also create this file **if it not exists** :
- `resources/lang/app.php` lang file if it not exists
- `tests/BrowserKitTest.php` base Feature TestCase class if it not exists
## Main purpose
#### Main purpose
The main purpose of this package is for faster **Test-driven Development**, it generates model CRUD scaffolds complete with Testing Classes which will use [Laravel Browserkit Testing](https://github.com/laravel/browser-kit-testing) package and [PHPUnit](https://packagist.org/packages/phpunit/phpunit) version 6.
Create mysql database, set your database credential on `.env` file. Then :
Make sure we have set our database credential on `.env` file. Then :
```bash
$ php artisan migrate
$ php artisan serve
```
Then visit our application url: `http://localhost:8000/vehicles`.
## Config file
By default, this package have some configuration:
@ -132,6 +147,8 @@ Next, to use the generated testing classes, we can set the database environment
</phpunit>
```
> If you are using Laravel 5.3, you need some [additional configuration](#only-for-laravel-53).
Then run PHPUnit
```bash
@ -142,6 +159,46 @@ All tests should be passed.

#### ONLY for Laravel 5.3
Before start using the package on Laravel 5.3, we need some configuration to make testing works (since it still has BrowserKit Testing features, we will use existing Laravel BaseTest Class and PHPUnit 5.7).
Then on `config/simple-crud.php` edit "base_test_path" and "base_test_class" value:
```php
// config/simple-crud.php
'base_test_path' => 'tests/TestCase.php',
'base_test_class' => 'TestCase',
```
Then add **loginAsUser** method on `tests/TestCase.php` file :
```php
<?php
use App\User;
abstract class TestCase extends Illuminate\Foundation\Testing\TestCase
{
// ... method createApplication()
protected function loginAsUser()
{
$user = factory(User::class)->create();
$this->actingAs($user);
return $user;
}
}
```
Done, you may continue to [try the testing suite](#lets-try-the-generated-testing-suite). Please [let me know](https://github.com/nafiesl/SimpleCrudGenerator/issues/new) if this configuration had **any issue**.
## License
This package is open-sourced software licensed under the [MIT license](LICENSE).