Add news tables and models #52
This commit is contained in:
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class CreateNewsTable extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('news', function (Blueprint $table) {
|
||||||
|
$table->increments('id');
|
||||||
|
$table->unsignedInteger('user_id');
|
||||||
|
$table->string('subject');
|
||||||
|
$table->text('body');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::drop('news');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -85,6 +85,22 @@ ranks:
|
|||||||
auto_approve_manual: 1
|
auto_approve_manual: 1
|
||||||
auto_promote: 0
|
auto_promote: 0
|
||||||
|
|
||||||
|
news:
|
||||||
|
- id: 1
|
||||||
|
user_id: 1
|
||||||
|
subject: Some VA News!
|
||||||
|
body: >
|
||||||
|
Lorem Ipsum is simply dummy text of the printing and
|
||||||
|
typesetting industry. Lorem Ipsum has been the industry's
|
||||||
|
standard dummy text ever since the 1500s, when an unknown
|
||||||
|
printer took a galley of type and scrambled it to make a
|
||||||
|
type specimen book. It has survived not only five centuries,
|
||||||
|
but also the leap into electronic typesetting, remaining
|
||||||
|
essentially unchanged. It was popularised in the 1960s with
|
||||||
|
the release of Letraset sheets containing Lorem Ipsum passages,
|
||||||
|
and more recently with desktop publishing software like
|
||||||
|
Aldus PageMaker including versions of Lorem Ipsum.
|
||||||
|
|
||||||
airports:
|
airports:
|
||||||
- id: KAUS
|
- id: KAUS
|
||||||
iata: AUS
|
iata: AUS
|
||||||
|
|||||||
32
app/Models/News.php
Normal file
32
app/Models/News.php
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class News
|
||||||
|
* @package App\Models
|
||||||
|
*/
|
||||||
|
class News extends BaseModel
|
||||||
|
{
|
||||||
|
public $table = 'news';
|
||||||
|
|
||||||
|
public $fillable = [
|
||||||
|
'user_id',
|
||||||
|
'subject',
|
||||||
|
'body',
|
||||||
|
];
|
||||||
|
|
||||||
|
public static $rules = [
|
||||||
|
'subject' => 'required',
|
||||||
|
'body' => 'required',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FOREIGN KEYS
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function user()
|
||||||
|
{
|
||||||
|
return $this->belongsTo(User::class, 'user_id');
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user