-
-
Notifications
You must be signed in to change notification settings - Fork 549
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 #468 from avored/developed
Developed to master
- Loading branch information
Showing
31 changed files
with
126,435 additions
and
301 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?php | ||
|
||
namespace App\Http\Controllers\Account; | ||
|
||
use App\Http\Controllers\Controller; | ||
use App\Http\Requests\Account\OrderCommentRequest; | ||
use App\Mails\OrderCommentMail; | ||
use AvoRed\Framework\Database\Contracts\ConfigurationModelInterface; | ||
use AvoRed\Framework\Database\Contracts\OrderCommentModelInterface; | ||
use AvoRed\Framework\Database\Models\Customer; | ||
use Illuminate\Support\Facades\Auth; | ||
use Illuminate\Support\Facades\Mail; | ||
|
||
class OrderCommentController extends Controller | ||
{ | ||
|
||
/** | ||
* Order Comment Repository | ||
* @param OrderCommentRepository $orderCommentRepository | ||
*/ | ||
protected $orderCommentRepository; | ||
/** | ||
* Configuration Repository | ||
* @param ConfigurationRepository $configurationRepository | ||
*/ | ||
protected $configurationRepository; | ||
|
||
|
||
/** | ||
* Order Comment Construct | ||
* @param OrderCommentRepository $orderCommentRepository | ||
*/ | ||
public function __construct( | ||
OrderCommentModelInterface $orderCommentRepository, | ||
ConfigurationModelInterface $configurationRepository | ||
) { | ||
$this->orderCommentRepository = $orderCommentRepository; | ||
$this->configurationRepository = $configurationRepository; | ||
} | ||
|
||
/** | ||
* Store Order Comment into database | ||
* @param int $orderId //Do not need route binding at this stage. | ||
* @param OrderCommentRequest $request | ||
* @return Redirect | ||
*/ | ||
public function store($orderId, OrderCommentRequest $request) | ||
{ | ||
$data = $request->all(); | ||
$data['order_id'] = $orderId; | ||
$data['commentable_id'] = Auth::guard('customer')->user()->id; | ||
$data['commentable_type'] = Customer::class; | ||
$data['is_private'] = false; | ||
|
||
$this->orderCommentRepository->create($data); | ||
$email = $this->configurationRepository->getValueByCode('order_email_address'); | ||
$url = route('admin.order.show', $orderId); | ||
Mail::to($email)->send(new OrderCommentMail($url)); | ||
|
||
return redirect()->route('account.order.show', $orderId); | ||
} | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace App\Http\Requests\Account; | ||
|
||
use Illuminate\Foundation\Http\FormRequest; | ||
|
||
class OrderCommentRequest extends FormRequest | ||
{ | ||
/** | ||
* Determine if the user is authorized to make this request. | ||
* | ||
* @return bool | ||
*/ | ||
public function authorize() | ||
{ | ||
return true; | ||
} | ||
|
||
/** | ||
* Get the validation rules that apply to the request. | ||
* | ||
* @return array | ||
*/ | ||
public function rules() | ||
{ | ||
return [ | ||
'content' => 'required' | ||
]; | ||
} | ||
} |
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,37 @@ | ||
<?php | ||
|
||
namespace App\Mails; | ||
|
||
use AvoRed\Framework\Database\Models\Order; | ||
use Illuminate\Bus\Queueable; | ||
use Illuminate\Mail\Mailable; | ||
use Illuminate\Queue\SerializesModels; | ||
|
||
class OrderCommentMail extends Mailable | ||
{ | ||
use Queueable, SerializesModels; | ||
|
||
/** | ||
* User Order Show Url | ||
* @param string $url | ||
*/ | ||
public $url; | ||
|
||
|
||
public function __construct(string $url) | ||
{ | ||
$this->url = $url; | ||
} | ||
/** | ||
* Build the message. | ||
* | ||
* @return $this | ||
*/ | ||
public function build() | ||
{ | ||
return $this | ||
->subject('Order Comment') | ||
->markdown('mails.comment-mail') | ||
->with('url', $this->url); | ||
} | ||
} |
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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<script> | ||
import VueSimplemde from 'vue-simplemde' | ||
export default { | ||
props: [], | ||
components: { | ||
'vue-simplemde': VueSimplemde | ||
}, | ||
data() { | ||
return { | ||
}; | ||
}, | ||
methods: { | ||
} | ||
}; | ||
</script> | ||
<style> | ||
@import '~simplemde/dist/simplemde.min.css'; | ||
</style> |
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
Oops, something went wrong.