mirror of
https://github.com/kevin-DL/LaravelShoppingcart.git
synced 2026-01-22 15:15:27 +00:00
Restructuring
Added codecov
This commit is contained in:
67
src/Config/cart.php
Normal file
67
src/Config/cart.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default tax rate
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This default tax rate will be used when you make a class implement the
|
||||
| Taxable interface and use the HasTax trait.
|
||||
|
|
||||
*/
|
||||
|
||||
'tax' => 21,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Shoppingcart database settings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you can set the connection that the shoppingcart should use when
|
||||
| storing and restoring a cart.
|
||||
|
|
||||
*/
|
||||
|
||||
'database' => [
|
||||
|
||||
'connection' => null,
|
||||
|
||||
'table' => 'shoppingcart',
|
||||
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Destroy the cart on user logout
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| When this option is set to 'true' the cart will automatically
|
||||
| destroy all cart instances when the user logs out.
|
||||
|
|
||||
*/
|
||||
|
||||
'destroy_on_logout' => false,
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Default number format
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This defaults will be used for the formatted numbers if you don't
|
||||
| set them in the method call.
|
||||
|
|
||||
*/
|
||||
|
||||
'format' => [
|
||||
|
||||
'decimals' => 2,
|
||||
|
||||
'decimal_point' => '.',
|
||||
|
||||
'thousand_separator' => ','
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateShoppingcartTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create(config('cart.database.table'), function (Blueprint $table) {
|
||||
$table->string('identifier');
|
||||
$table->string('instance');
|
||||
$table->longText('content');
|
||||
$table->nullableTimestamps();
|
||||
|
||||
$table->primary(['identifier', 'instance']);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::drop(config('cart.database.table'));
|
||||
}
|
||||
}
|
||||
@@ -18,10 +18,10 @@ class ShoppingcartServiceProvider extends ServiceProvider
|
||||
{
|
||||
$this->app->bind('cart', 'Gloudemans\Shoppingcart\Cart');
|
||||
|
||||
$config = __DIR__ . '/../config/cart.php';
|
||||
$config = __DIR__ . '/Config/cart.php';
|
||||
$this->mergeConfigFrom($config, 'cart');
|
||||
|
||||
$this->publishes([__DIR__ . '/../config/cart.php' => config_path('cart.php')], 'config');
|
||||
$this->publishes([__DIR__ . '/Config/cart.php' => config_path('cart.php')], 'config');
|
||||
|
||||
$this->app['events']->listen(Logout::class, function () {
|
||||
if ($this->app['config']->get('cart.destroy_on_logout')) {
|
||||
@@ -30,7 +30,7 @@ class ShoppingcartServiceProvider extends ServiceProvider
|
||||
});
|
||||
|
||||
$this->publishes([
|
||||
realpath(__DIR__.'/../database/migrations') => $this->app->databasePath().'/migrations'
|
||||
realpath(__DIR__.'/Database/migrations') => $this->app->databasePath().'/migrations'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user