Skip to content

Commit

Permalink
Initial Release
Browse files Browse the repository at this point in the history
  • Loading branch information
repat committed Feb 26, 2020
0 parents commit 13a43e7
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@
.DS_Store
composer.lock
vendor/
22 changes: 22 additions & 0 deletions LICENSE
@@ -0,0 +1,22 @@
[MIT LICENSE]

Copyright (c) 2020 repat, https://repat.de

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Software), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, andor sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
41 changes: 41 additions & 0 deletions README.md
@@ -0,0 +1,41 @@
# laravel-migration-model
[![Latest Version on Packagist](https://img.shields.io/packagist/v/repat/laravel-migration-model.svg?style=flat-square)](https://packagist.org/packages/repat/laravel-migration-model)
[![Total Downloads](https://img.shields.io/packagist/dt/repat/laravel-migration-model.svg?style=flat-square)](https://packagist.org/packages/repat/laravel-migration-model)

**laravel-migration-model** contains one Eloquent model for the `migrations` table.

## Installation
`$ composer require repat/laravel-migration-model`

## Documentation

#### Attributes/Methods

```php
$migration = \Repat\Laravel\Migration::first();

// Attributes from table
$migration->id;
$migration->migration;
$migration->batch;

// Mutator attributes
$migration->filename;

// Methods
$migration->fileExists();
```

## License
* MIT, see [LICENSE](https://github.com/repat/laravel-migration-model/blob/master/LICENSE)

## Version
* Version 0.1

## Contact
#### repat
* Homepage: https://repat.de
* e-mail: repat@repat.de
* Twitter: [@repat123](https://twitter.com/repat123 "repat123 on twitter")

[![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=repat&url=https://github.com/repat/laravel-migration-model&title=laravel-migration-model&language=&tags=github&category=software)
20 changes: 20 additions & 0 deletions composer.json
@@ -0,0 +1,20 @@
{
"name": "repat/laravel-migration-model",
"description": "Eloquent Model for the migrations table",
"keywords": ["laravel", "eloquent", "migrations", "model", "migration", "artisan"],
"homepage": "https://repat.de",
"license": "MIT",
"version" : "0.1",
"authors": [
{"name": "repat", "email": "repat@repat.de"}
],
"require": {
"php": ">=5.6",
"laravel/framework": "^5.0 | ^6.0"
},
"autoload": {
"psr-4": {
"Repat\\LaravelJobs\\": "src/Repat/Laravel"
}
}
}
40 changes: 40 additions & 0 deletions src/Repat/Laravel/Migration.php
@@ -0,0 +1,40 @@
<?php

namespace Repat\Laravel;

class Migration extends \Illuminate\Database\Eloquent\Model
{
/**
* Table is not timestamped
*
* @var bool
*/
public $timestamps = false;

/**
* Database table
*
* @var string
*/
protected $table = 'migrations';

/**
* Returns if the migration file exists on the hard drive
*
* @return bool
*/
public function fileExists() : bool
{
return file_exists(base_path('database/migrations/' . $this->filename));
}

/**
* Returns Filename
*
* @return string
*/
public function getFilenameAttribute() : string
{
return $this->migration . '.php';
}
}

0 comments on commit 13a43e7

Please sign in to comment.