1. Go to this page and download the library: Download anwar/crud-generator library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
// Feature Test Example
public function test_can_create_post()
{
$data = ['title' => 'Test Post', 'content' => 'Test Content'];
$response = $this->post(route('posts.store'), $data);
$response->assertRedirect(route('posts.index'));
$this->assertDatabaseHas('posts', $data);
}
// API Test Example
public function test_api_can_list_posts()
{
Post::factory(3)->create();
$response = $this->getJson('/api/posts');
$response->assertOk()
->assertJsonCount(3, 'data');
}
bash
# 1. BACKUP YOUR DATABASE FIRST!
mysqldump -u user -p database_name > backup.sql
# 2. Install the package
composer endor:publish --tag=crudgenerator-migrations
php artisan vendor:publish --tag=crudgenerator-assets
# 4. Review published migrations first!
ls database/migrations/*anwar*
# 5. Only run if safe
php artisan migrate