8 changed files with 183 additions and 6 deletions
-
57app/Cart/TransactionDraft.php
-
23app/Http/Controllers/CartController.php
-
13app/Transaction.php
-
38database/migrations/2017_04_27_121204_create_transactions_table.php
-
2resources/views/cart/partials/draft-confirm.blade.php
-
4resources/views/cart/partials/form-draft-detail.blade.php
-
1routes/web.php
-
51tests/Unit/Integration/TransactionDraftTest.php
@ -0,0 +1,13 @@ |
|||
<?php |
|||
|
|||
namespace App; |
|||
|
|||
use Illuminate\Database\Eloquent\Model; |
|||
|
|||
class Transaction extends Model |
|||
{ |
|||
protected $casts = [ |
|||
'items' => 'array', |
|||
'customer' => 'array', |
|||
]; |
|||
} |
|||
@ -0,0 +1,38 @@ |
|||
<?php |
|||
|
|||
use Illuminate\Support\Facades\Schema; |
|||
use Illuminate\Database\Schema\Blueprint; |
|||
use Illuminate\Database\Migrations\Migration; |
|||
|
|||
class CreateTransactionsTable extends Migration |
|||
{ |
|||
/** |
|||
* Run the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function up() |
|||
{ |
|||
Schema::create('transactions', function (Blueprint $table) { |
|||
$table->increments('id'); |
|||
$table->char('invoice_no', 8); |
|||
$table->text('items'); |
|||
$table->string('customer'); |
|||
$table->unsignedInteger('payment'); |
|||
$table->unsignedInteger('total'); |
|||
$table->string('notes')->nullable(); |
|||
$table->unsignedInteger('user_id'); |
|||
$table->timestamps(); |
|||
}); |
|||
} |
|||
|
|||
/** |
|||
* Reverse the migrations. |
|||
* |
|||
* @return void |
|||
*/ |
|||
public function down() |
|||
{ |
|||
Schema::dropIfExists('transactions'); |
|||
} |
|||
} |
|||
@ -1,9 +1,9 @@ |
|||
<legend>{{ trans('transaction.detail') }}</legend> |
|||
{{ Form::open(['route' => ['cart.draft-proccess', $draft->draftKey], 'method' => 'patch']) }} |
|||
{!! FormField::text('customer[name]', ['label' => trans('transaction.customer_name'), 'value' => $draft->customer['name']]) !!} |
|||
{!! FormField::text('customer[name]', ['label' => trans('transaction.customer_name'), 'value' => $draft->customer['name'], 'required' => true]) !!} |
|||
<div class="row"> |
|||
<div class="col-md-6">{!! FormField::text('customer[phone]', ['label' => trans('transaction.customer_phone'), 'value' => $draft->customer['phone']]) !!}</div> |
|||
<div class="col-md-6">{!! FormField::price('payment', ['label' => trans('transaction.payment'), 'value' => $draft->payment]) !!}</div> |
|||
<div class="col-md-6">{!! FormField::price('payment', ['label' => trans('transaction.payment'), 'value' => $draft->payment, 'required' => true]) !!}</div> |
|||
</div> |
|||
{!! FormField::textarea('notes', ['label' => trans('transaction.notes'), 'value' => $draft->notes]) !!} |
|||
{{ Form::submit(trans('transaction.proccess'), ['class' => 'btn btn-info']) }} |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue