-
Notifications
You must be signed in to change notification settings - Fork 1
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 #12 from ducthang-vu/seeder-relationships
seeder & relationships
- Loading branch information
Showing
20 changed files
with
223 additions
and
47 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,26 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Flat extends Model | ||
{ | ||
// | ||
|
||
/** | ||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo | ||
*/ | ||
public function user() | ||
{ | ||
return $this->belongsTo('App\User'); | ||
} | ||
|
||
/** | ||
* @return \Illuminate\Database\Eloquent\Relations\HasMany | ||
*/ | ||
public function requests() | ||
{ | ||
return $this->hasMany('App\Request'); | ||
} | ||
} |
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,18 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Request extends Model | ||
{ | ||
// | ||
|
||
/** | ||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo | ||
*/ | ||
public function flat() | ||
{ | ||
return $this->belongsTo('App\Flat'); | ||
} | ||
} |
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,10 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Service extends Model | ||
{ | ||
// | ||
} |
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,10 @@ | ||
<?php | ||
|
||
namespace App; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class Sponsorship extends Model | ||
{ | ||
// | ||
} |
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
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,51 @@ | ||
<?php | ||
|
||
return [ | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Schematics | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here you may define the namespaces, middleware and toggle auto-migration. | ||
| Middleware will be applied to the schematic routes and auto-migration | ||
| will run the up and down methods on edit events through the UI. | ||
| | ||
*/ | ||
|
||
'controller-namespace' => null, | ||
'form-request-namespace' => 'App\\Http\\Requests', | ||
'model' => [ | ||
'namespace' => 'App\\', | ||
'path' => app_path(), | ||
'paths' => [ | ||
app_path(), | ||
], | ||
], | ||
'middleware' => null, | ||
'auto-migrate' => false, | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Create, Update & Delete | ||
|-------------------------------------------------------------------------- | ||
| | ||
| Here you may define defaults for the scaffolding. These will set | ||
| the checkboxes in the forms to be checked or not. | ||
| | ||
*/ | ||
|
||
'create' => [ | ||
'migration' => false, | ||
'resource-controller' => false, | ||
'form-request' => false, | ||
], | ||
|
||
'update' => [ | ||
'migration' => false, | ||
], | ||
|
||
'delete' => [ | ||
'migration' => false, | ||
], | ||
]; |
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
45 changes: 0 additions & 45 deletions
45
database/migrations/2020_07_07_151351_create_flats_table.php
This file was deleted.
Oops, something went wrong.
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
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\Database\Seeder; | ||
use App\Sponsorship; | ||
|
||
class SponsorshipSeeder extends Seeder | ||
{ | ||
/** | ||
* Run the database seeds. | ||
* | ||
* @return void | ||
*/ | ||
public function run() | ||
{ | ||
$sponsorships = [ | ||
[ | ||
'type' => '24 ore', | ||
'price' => 2.99, | ||
'duration' => '24:00:00' | ||
], | ||
[ | ||
'type' => '72 ore', | ||
'price' => 5.99, | ||
'duration' => '72:00:00' | ||
], | ||
[ | ||
'type' => '144 ore', | ||
'price' => 9.99, | ||
'duration' => '144:00:00' | ||
] | ||
]; | ||
|
||
foreach ($sponsorships as $sponsorship) { | ||
$new_sponsorship = new Sponsorship(); | ||
$new_sponsorship->sponsor_type = $sponsorship['type']; | ||
$new_sponsorship->price = $sponsorship['price']; | ||
$new_sponsorship->duration = $sponsorship['duration']; | ||
|
||
$new_sponsorship->save(); | ||
}; | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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 @@ | ||
/*! | ||
* Font Awesome Free 5.12.1 by @fontawesome - https://fontawesome.com | ||
* License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) | ||
*/ | ||
|
||
/*! | ||
* Sizzle CSS Selector Engine v2.3.4 | ||
* https://sizzlejs.com/ | ||
* | ||
* Copyright JS Foundation and other contributors | ||
* Released under the MIT license | ||
* https://js.foundation/ | ||
* | ||
* Date: 2019-04-08 | ||
*/ | ||
|
||
/*! | ||
* Vue.js v2.6.11 | ||
* (c) 2014-2019 Evan You | ||
* Released under the MIT License. | ||
*/ | ||
|
||
/*! | ||
* jQuery JavaScript Library v3.4.1 | ||
* https://jquery.com/ | ||
* | ||
* Includes Sizzle.js | ||
* https://sizzlejs.com/ | ||
* | ||
* Copyright JS Foundation and other contributors | ||
* Released under the MIT license | ||
* https://jquery.org/license | ||
* | ||
* Date: 2019-05-01T21:04Z | ||
*/ | ||
|
||
/**! | ||
* Sortable 1.10.2 | ||
* @author RubaXa <[email protected]> | ||
* @author owenm <[email protected]> | ||
* @license MIT | ||
*/ |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,4 @@ | ||
{ | ||
"/app.js": "/app.js", | ||
"/app.css": "/app.css" | ||
} |