<commit_before><?php namespace CoandaCMS\Coanda\Media\Repositories\Eloquent\Models;

use Eloquent, Coanda, App, Config, File;
use Carbon\Carbon;

use CoandaCMS\Coanda\Media\ImageHandlers\DefaultImageHandler as ImageHandler;

use CoandaCMS\Coanda\Media\Exceptions\ImageGenerationException;
use CoandaCMS\Coanda\Media\Exceptions\OriginalFileCacheException;

/**
 * Class Media
 * @package CoandaCMS\Coanda\Media\Repositories\Eloquent\Models
 */
class Media extends Eloquent {

	use \CoandaCMS\Coanda\Core\Presenters\PresentableTrait;

    /**
     * @var string
     */
    protected $presenter = 'CoandaCMS\Coanda\Media\Presenters\Media';

	/**
	 * The database table used by the model.
	 *
	 * @var string
	 */
	protected $table = 'media';

    /**
     * @var ImageHandler
     */
    private $image_handler;

    /**
     *
     */
    public function __construct()
	{
		$this->image_handler = new ImageHandler;
	}

    /**
     *
     */
    public function delete()
	{
		$original_file = base_path() . '/' . Config::get('coanda::coanda.uploads_directory') . '/' . $this->filename;

		if (file_exists($original_file))
		{
			unlink($original_file);
		}

		foreach ($this->tags()->lists('media_tag_id') as $tag_id)
		{
			$this->tags()->detach($tag_id);
		}

		parent::delete();
	}
<commit_msg>Bugfix to delete media path<commit_after><?php namespace CoandaCMS\Coanda\Media\Repositories\Eloquent\Models;

use Eloquent, Coanda, App, Config, File;
use Carbon\Carbon;

use CoandaCMS\Coanda\Media\ImageHandlers\DefaultImageHandler as ImageHandler;

use CoandaCMS\Coanda\Media\Exceptions\ImageGenerationException;
use CoandaCMS\Coanda\Media\Exceptions\OriginalFileCacheException;

/**
 * Class Media
 * @package CoandaCMS\Coanda\Media\Repositories\Eloquent\Models
 */
class Media extends Eloquent {

	use \CoandaCMS\Coanda\Core\Presenters\PresentableTrait;

    /**
     * @var string
     */
    protected $presenter = 'CoandaCMS\Coanda\Media\Presenters\Media';

	/**
	 * The database table used by the model.
	 *
	 * @var string
	 */
	protected $table = 'media';

    /**
     * @var ImageHandler
     */
    private $image_handler;

    /**
     *
     */
    public function __construct()
	{
		$this->image_handler = new ImageHandler;
	}

    /**
     *
     */
    public function delete()
	{
		$original_file = Config::get('coanda::coanda.uploads_directory') . '/' . $this->filename;

		if (file_exists($original_file))
		{
			unlink($original_file);
		}

		foreach ($this->tags()->lists('media_tag_id') as $tag_id)
		{
			$this->tags()->detach($tag_id);
		}

		parent::delete();
	}

{'fraction_non_alphanumeric': 0.14269141531322505, 'fraction_numerical': 0.0, 'mean_word_length': 3.3699324324324325, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4939877', 'n_tokens_mistral': 935, 'n_tokens_neox': 861, 'n_words': 147}