save amount of payment for each publication, in case if admin chenges fee
This commit is contained in:
parent
b1de3a66ae
commit
80f394571d
|
|
@ -25,7 +25,7 @@ class User extends UserBase
|
|||
public $rules = [
|
||||
'email' => 'required|between:6,255|email|unique:users',
|
||||
'avatar' => 'nullable|image|max:4000',
|
||||
'username' => 'required|digits_between:8,20|numeric|unique:users',
|
||||
'username' => 'required|unique:users',
|
||||
'password' => 'required:create|between:8,255|confirmed',
|
||||
'password_confirmation' => 'required_with:password|between:8,255',
|
||||
];
|
||||
|
|
|
|||
|
|
@ -73,6 +73,8 @@ class OfferForm extends ComponentBase
|
|||
$product->mark = $data['mark'];
|
||||
$product->manufacturer = $data['manufacturer'];
|
||||
$product->country_id = $data['country_id'];
|
||||
$product->created_at = Carbon::now('Asia/Ashgabat');
|
||||
$product->vendor_id = \Auth::user()->id;
|
||||
|
||||
$category->products()->save($product);
|
||||
|
||||
|
|
@ -132,12 +134,6 @@ class OfferForm extends ComponentBase
|
|||
$attachedProduct->save();
|
||||
}
|
||||
|
||||
// $draft_offers = \Auth::user()->products()
|
||||
// ->where('status','draft')
|
||||
// ->orderBy('created_at', 'desc')->get();
|
||||
|
||||
// $this->page['draft_offers'] = $draft_offers;
|
||||
// $this->page['draft_offers_count'] = count($draft_offers);
|
||||
$this->page['fee'] = Settings::getValue('fee');
|
||||
$this->page['product'] = $attachedProduct;
|
||||
|
||||
|
|
@ -156,6 +152,9 @@ class OfferForm extends ComponentBase
|
|||
$user->save();
|
||||
|
||||
$product = Product::find(Input::get('product_id'));
|
||||
//save how much user payed because fee can be changed by admin tomorrow
|
||||
// if post is denied we get back payed fee, not admin's set fee
|
||||
$product->payed_fee_for_publ = Settings::getValue('fee');
|
||||
$product->status = 'new';
|
||||
$product->save();
|
||||
|
||||
|
|
@ -190,7 +189,6 @@ class OfferForm extends ComponentBase
|
|||
}
|
||||
|
||||
protected function fillProduct($data,$attachedProduct) {
|
||||
$attachedProduct->vendor_id = \Auth::user()->id;
|
||||
$attachedProduct->description = $data['description_tm'];
|
||||
// Sets a single translated attribute for a language
|
||||
$attachedProduct->setAttributeTranslated('description', $data['description_ru'], 'ru');
|
||||
|
|
@ -204,7 +202,6 @@ class OfferForm extends ComponentBase
|
|||
$attachedProduct->packaging = $data['packaging'];
|
||||
$attachedProduct->place = $data['place'];
|
||||
$attachedProduct->currency_id = $data['currency_id'];
|
||||
$attachedProduct->created_at = Carbon::now('Asia/Ashgabat');
|
||||
// $attachedProduct->ends_at = $data['ends_at'];
|
||||
$attachedProduct->save();
|
||||
|
||||
|
|
|
|||
|
|
@ -55,10 +55,6 @@ class Product extends Model
|
|||
'payment' => ['TPS\Birzha\Models\Payment'],
|
||||
];
|
||||
|
||||
public $hasMany = [
|
||||
'offers' => 'TPS\Birzha\Models\Offer'
|
||||
];
|
||||
|
||||
public $attachMany = [
|
||||
'images' => 'System\Models\File'
|
||||
];
|
||||
|
|
|
|||
|
|
@ -0,0 +1,23 @@
|
|||
<?php namespace TPS\Birzha\Updates;
|
||||
|
||||
use Schema;
|
||||
use October\Rain\Database\Updates\Migration;
|
||||
|
||||
class BuilderTableUpdateTpsBirzhaProducts17 extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::table('tps_birzha_products', function($table)
|
||||
{
|
||||
$table->decimal('payed_fee_for_publ', 10, 2)->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::table('tps_birzha_products', function($table)
|
||||
{
|
||||
$table->dropColumn('payed_fee_for_publ');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -206,3 +206,9 @@
|
|||
1.0.70:
|
||||
- 'Updated table tps_birzha_payments'
|
||||
- builder_table_update_tps_birzha_payments_4.php
|
||||
1.0.71:
|
||||
- 'Created table tps_birzha_publications_history'
|
||||
- builder_table_create_tps_birzha_publications_history.php
|
||||
1.0.72:
|
||||
- 'Updated table tps_birzha_products'
|
||||
- builder_table_update_tps_birzha_products_17.php
|
||||
|
|
|
|||
Loading…
Reference in New Issue