mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
Shift automatically applies the Laravel coding style - which uses the PSR-12 coding style as a base with some minor additions. You may customize the code style applied by configuring [Pint](https://laravel.com/docs/pint), [PHP CS Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer), or [PHP CodeSniffer](https://github.com/squizlabs/PHP_CodeSniffer) for your project root. For more information on customizing the code style applied by Shift, [watch this short video](https://laravelshift.com/videos/shift-code-style).
79 lines
1.7 KiB
PHP
79 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Observers;
|
|
|
|
use App\Models\Course;
|
|
use App\Traits\TwitterTrait;
|
|
|
|
class CourseObserver
|
|
{
|
|
use TwitterTrait;
|
|
|
|
/**
|
|
* Handle the Course "created" event.
|
|
*
|
|
* @param \App\Models\Course $course
|
|
* @return void
|
|
*/
|
|
public function created(Course $course)
|
|
{
|
|
if (config('feeds.services.twitterAccountId')) {
|
|
$this->setNewAccessToken(1);
|
|
|
|
$text = sprintf("Unser Dozent %s hat einen neuen Kurs eingestellt:\n\n%s\n\n%s\n\n%s\n\n#Bitcoin #Kurs #Education #Einundzwanzig #gesundesgeld",
|
|
$course->lecturer->name,
|
|
$course->name,
|
|
str($course->description)->limit(80),
|
|
url()->route('school.landingPage.lecturer',
|
|
['country' => 'de', 'lecturer' => $course->lecturer]),
|
|
);
|
|
|
|
$this->postTweet($text);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Handle the Course "updated" event.
|
|
*
|
|
* @param \App\Models\Course $course
|
|
* @return void
|
|
*/
|
|
public function updated(Course $course)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Handle the Course "deleted" event.
|
|
*
|
|
* @param \App\Models\Course $course
|
|
* @return void
|
|
*/
|
|
public function deleted(Course $course)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Handle the Course "restored" event.
|
|
*
|
|
* @param \App\Models\Course $course
|
|
* @return void
|
|
*/
|
|
public function restored(Course $course)
|
|
{
|
|
//
|
|
}
|
|
|
|
/**
|
|
* Handle the Course "force deleted" event.
|
|
*
|
|
* @param \App\Models\Course $course
|
|
* @return void
|
|
*/
|
|
public function forceDeleted(Course $course)
|
|
{
|
|
//
|
|
}
|
|
}
|