-
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from andes2912/feature/perpustakaan
Perpustakaan
- Loading branch information
Showing
44 changed files
with
2,446 additions
and
4 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
Modules/Perpustakaan/Database/Migrations/2022_05_20_062053_create_authors_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\Support\Facades\Schema; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class CreateAuthorsTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('authors', function (Blueprint $table) { | ||
$table->id(); | ||
$table->string('name')->unique(); | ||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::dropIfExists('authors'); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
Modules/Perpustakaan/Database/Migrations/2022_05_20_062103_create_publishers_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,34 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\Schema; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class CreatePublishersTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('publishers', function (Blueprint $table) { | ||
$table->id(); | ||
$table->string('name')->unique(); | ||
$table->string('address')->nullable(); | ||
$table->string('phone')->nullable(); | ||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::dropIfExists('publishers'); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
Modules/Perpustakaan/Database/Migrations/2022_05_20_062130_create_categories_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\Support\Facades\Schema; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class CreateCategoriesTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('categories', function (Blueprint $table) { | ||
$table->id(); | ||
$table->string('name')->unique(); | ||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::dropIfExists('categories'); | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
Modules/Perpustakaan/Database/Migrations/2022_05_20_062140_create_books_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,42 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\Schema; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class CreateBooksTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('books', function (Blueprint $table) { | ||
$table->id(); | ||
$table->string('book_code')->unique(); | ||
$table->string('name'); | ||
$table->longText('description'); | ||
$table->string('thumbnail'); | ||
$table->foreignId('category_id'); | ||
$table->foreignId('author_id'); | ||
$table->foreignId('publisher_id'); | ||
$table->year('publication_year'); | ||
$table->string('isbn', 50); | ||
$table->integer('stock'); | ||
$table->boolean('is_available')->default('0'); | ||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::dropIfExists('books'); | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
Modules/Perpustakaan/Database/Migrations/2022_05_20_062219_create_members_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,35 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\Schema; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class CreateMembersTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('members', function (Blueprint $table) { | ||
$table->id(); | ||
$table->string('member_code')->unique(); | ||
$table->foreignId('user_id')->unique(); | ||
$table->string('name'); | ||
$table->boolean('is_active')->default(0); | ||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::dropIfExists('members'); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
Modules/Perpustakaan/Database/Migrations/2022_05_20_062236_create_borrowings_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,37 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\Schema; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class CreateBorrowingsTable extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('borrowings', function (Blueprint $table) { | ||
$table->id(); | ||
$table->string('borrow_code')->unique(); | ||
$table->foreignId('member_id'); | ||
$table->foreignId('book_id'); | ||
$table->date('borrow_date'); | ||
$table->date('return_date'); | ||
$table->date('lateness')->nullable(); | ||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::dropIfExists('borrowings'); | ||
} | ||
} |
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,13 @@ | ||
<?php | ||
|
||
namespace Modules\Perpustakaan\Entities; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
|
||
class Author extends Model | ||
{ | ||
use HasFactory; | ||
|
||
protected $guarded = ''; | ||
} |
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 Modules\Perpustakaan\Entities; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
|
||
class Book extends Model | ||
{ | ||
use HasFactory; | ||
|
||
protected $guarded = ''; | ||
|
||
public function publisher() | ||
{ | ||
return $this->belongsTo(Publisher::class,'publisher_id'); | ||
} | ||
|
||
public function author() | ||
{ | ||
return $this->belongsTo(Author::class,'author_id'); | ||
} | ||
|
||
public function category() | ||
{ | ||
return $this->belongsTo(Category::class,'category_id'); | ||
} | ||
} |
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,23 @@ | ||
<?php | ||
|
||
namespace Modules\Perpustakaan\Entities; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
|
||
class Borrowing extends Model | ||
{ | ||
use HasFactory; | ||
|
||
protected $guarded = ''; | ||
|
||
public function members() | ||
{ | ||
return $this->hasOne(Member::class,'id','member_id'); | ||
} | ||
|
||
public function books() | ||
{ | ||
return $this->hasOne(Book::class,'id','book_id'); | ||
} | ||
} |
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,13 @@ | ||
<?php | ||
|
||
namespace Modules\Perpustakaan\Entities; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
|
||
class Category extends Model | ||
{ | ||
use HasFactory; | ||
|
||
protected $guarded = ''; | ||
} |
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,15 @@ | ||
<?php | ||
|
||
namespace Modules\Perpustakaan\Entities; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
|
||
class Member extends Model | ||
{ | ||
use HasFactory; | ||
|
||
protected $guarded = ''; | ||
|
||
|
||
} |
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,13 @@ | ||
<?php | ||
|
||
namespace Modules\Perpustakaan\Entities; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
|
||
class Publisher extends Model | ||
{ | ||
use HasFactory; | ||
|
||
protected $guarded = ''; | ||
} |
Oops, something went wrong.