-
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.
* Add changes with CR * Add validate to generate jitsi object and add filter date for api constultations list * Repair bug in register settingsProvider * Force cart version, todo after changes in cart package * Add changes after CR * Add changes from new cart package * Change inputs in request * Add set relations to proposed terms and add possibility upload logotype Co-authored-by: Hubert Krzysztofiak <hubert.krzysztofiak@escolasoft.com>
- Loading branch information
Showing
28 changed files
with
531 additions
and
53 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,21 @@ | ||
<?php | ||
|
||
namespace EscolaLms\Consultations\Database\Factories; | ||
|
||
use EscolaLms\Consultations\Models\Consultation; | ||
use EscolaLms\Consultations\Models\ConsultationProposedTerm; | ||
use Illuminate\Database\Eloquent\Factories\Factory; | ||
|
||
class ConsultationProposedTermFactory extends Factory | ||
{ | ||
protected $model = ConsultationProposedTerm::class; | ||
|
||
public function definition() | ||
{ | ||
$consultation = Consultation::firstOrCreate(); | ||
return [ | ||
'consultation_id' => $consultation->getKey(), | ||
'proposed_at' => $this->faker->dateTimeBetween($consultation->active_from, $consultation->active_to), | ||
]; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
database/migrations/2022_02_18_110049_create_consultation_proposed_terms_tale.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,35 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
class CreateConsultationProposedTermsTale extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('consultation_proposed_terms', function (Blueprint $table) { | ||
$table->id(); | ||
$table->bigInteger('consultation_id')->unsigned(); | ||
$table->dateTime('proposed_at'); | ||
$table->timestamps(); | ||
|
||
$table->foreign('consultation_id')->on('consultations')->references('id')->cascadeOnDelete(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::dropIfExists('consultation_proposed_terms'); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
database/migrations/2022_02_21_193601_add_column_image_path_for_consultations_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 AddColumnImagePathForConsultationsTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::table('consultations', function (Blueprint $table) { | ||
$table->string('image_path')->nullable(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::table('consultations', function (Blueprint $table) { | ||
$table->dropColumn('image_path'); | ||
}); | ||
} | ||
} |
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,53 @@ | ||
<?php | ||
|
||
namespace EscolaLms\Consultations\Helpers; | ||
|
||
class StrategyHelper | ||
{ | ||
private string $namespace; | ||
|
||
public function __construct(string $baseStrategyName) | ||
{ | ||
$this->setNamespace($baseStrategyName); | ||
} | ||
|
||
/** | ||
* This method used strategy pattern and execute method given in the parameters | ||
* Strategy dir it must contain minimum to file: BaseStrategy contain in pattern {{parentDir}}Strategy | ||
* in localization ?/Strategies/{{parentDir}} and strategy class in the same localization | ||
* | ||
* @param string $className | ||
* @param string $baseStrategyName | ||
* @param string $method | ||
* @param ...$params | ||
* @return mixed|null | ||
*/ | ||
public static function useStrategyPattern( | ||
string $className, | ||
string $baseStrategyName, | ||
string $method, | ||
...$params | ||
) { | ||
$strategyHelper = new StrategyHelper($baseStrategyName); | ||
$class = $strategyHelper->namespace . '\\' . $className; | ||
$baseStrategyClass = $strategyHelper->namespace . '\\' . $baseStrategyName; | ||
if ( | ||
class_exists($class) && | ||
class_exists($baseStrategyClass) && | ||
method_exists($baseStrategyClass, $method) | ||
) { | ||
$strategy = new $baseStrategyClass( | ||
new $class($params) | ||
); | ||
|
||
return $strategy->$method(); | ||
} | ||
return null; | ||
} | ||
|
||
private function setNamespace(string $baseStrategyName): void | ||
{ | ||
$this->namespace = 'EscolaLms\Consultations\Strategies\\' . | ||
preg_replace('/^(.*)Strategy$/', '$1', $baseStrategyName); | ||
} | ||
} |
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,18 @@ | ||
<?php | ||
|
||
namespace EscolaLms\Consultations\Http\Resources; | ||
|
||
use EscolaLms\Auth\Traits\ResourceExtandable; | ||
use Illuminate\Http\Resources\Json\JsonResource; | ||
use Illuminate\Support\Carbon; | ||
|
||
class ConsultationProposedTermResource extends JsonResource | ||
{ | ||
use ResourceExtandable; | ||
|
||
public function toArray($request) | ||
{ | ||
$proposedAt = is_string($this->proposed_at) ? Carbon::make($this->proposed_at) : $this->proposed_at; | ||
return $proposedAt->format('Y-m-d H:i:s'); | ||
} | ||
} |
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,28 @@ | ||
<?php | ||
|
||
namespace EscolaLms\Consultations\Models; | ||
|
||
use EscolaLms\Consultations\Database\Factories\ConsultationProposedTermFactory; | ||
use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Database\Eloquent\Relations\BelongsTo; | ||
|
||
class ConsultationProposedTerm extends Model | ||
{ | ||
use HasFactory; | ||
|
||
protected $fillable = [ | ||
'consultation_id', | ||
'proposed_at', | ||
]; | ||
|
||
public function consultation(): BelongsTo | ||
{ | ||
return $this->belongsTo(Consultation::class, 'consultation_id'); | ||
} | ||
|
||
protected static function newFactory(): ConsultationProposedTermFactory | ||
{ | ||
return ConsultationProposedTermFactory::new(); | ||
} | ||
} |
Oops, something went wrong.