Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 13a43e7
Showing
5 changed files
with
126 additions
and
0 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,3 @@ | ||
.DS_Store | ||
composer.lock | ||
vendor/ |
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 @@ | ||
[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. |
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,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) |
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,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" | ||
} | ||
} | ||
} |
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,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'; | ||
} | ||
} |