htech/mock-entry

Mock entries for easy management. Create database entries that will not show in production

v1.0.0 2020-07-30 10:38 UTC

This package is auto-updated.

Last update: 2024-10-04 13:06:24 UTC


README

Laravel Mocker

Mock entries for easy management. Create database entries that will not show in production

Installation

	composer require htech/mock-entry

Usage

  1. If you want to save data for testing just turn on debug mode in .env
   APP_DEBUG = TRUE
  1. Add MockEntry trait to your models.
<?php

namespace App;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Passport\HasApiTokens;
use Htech\MockEntry\Traits\MockEntry;

class User extends Authenticatable
{
    use HasApiTokens,MockEntry;
  1. Add for_testing column with data type of tinyInteger in the table you want to use mock entries.
Schema::table([table_name], function (Blueprint $table) {
   $table->tinyInteger('for_testing')->default(1);
});
  1. If you want to delete all mock entries in your database access this route. {{root}}/remove-test-data

Troubleshooting

  • If you have problems in installing with lower versions of PHP. Try adding params ignore-platform-reqs in composer require
	composer require htech/mock-entry --ignore-platform-reqs 
  • If configuration doesn't allow you to allow connections to the server especially in your localhost. try this command before installing the package. (Not Recommended)
composer config -g secure-http false

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

License

The GNU General Public License v3.0 (GNU GPLv3). Please see License File for more information.