forked from laravel/framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request laravel#534 from eurides-eu/implement-subscription…
…-approval-page Finished service approval UI + backend
- Loading branch information
Showing
23 changed files
with
592 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
app/Subscriptions/Events/EnsureSubscriptionApprovedAtColumnSet.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace App\Transactions\Events; | ||
|
||
use App\Models\Subscription; | ||
use Illuminate\Support\Carbon; | ||
|
||
class EnsureSubscriptionApprovedAtColumnSet | ||
{ | ||
public function creating(Subscription $model) | ||
{ | ||
$this->check($model); | ||
} | ||
|
||
public function updating(Subscription $model) | ||
{ | ||
$this->check($model); | ||
} | ||
|
||
private function check(Subscription $subscription) | ||
{ | ||
if (Subscription::APPROVED === $subscription->status && null === $subscription->approved_at) { | ||
$subscription->approved_at = Carbon::now(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...19_02_21_134909_add_approver_motivation_and_date_and_id_column_to_subscriptions_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class AddApproverMotivationAndDateAndIdColumnToSubscriptionsTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up() | ||
{ | ||
Schema::table('subscriptions', function (Blueprint $table) { | ||
$table->timestamp('approved_at')->nullable()->after('deleted_at'); | ||
$table->string('approver_id')->after('document_id')->nullable(); | ||
$table->string('approver_motivation')->nullable(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down() | ||
{ | ||
Schema::table('subscriptions', function (Blueprint $table) { | ||
$table->dropColumn('approver_motivation'); | ||
$table->dropColumn('approver_id'); | ||
$table->dropColumn('approved_at'); | ||
}); | ||
} | ||
} |
Oops, something went wrong.