mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Add media model, migration, controller
This commit is contained in:
parent
7221f44e4a
commit
6982e8672a
3 changed files with 61 additions and 0 deletions
10
app/Http/Controllers/MediaController.php
Normal file
10
app/Http/Controllers/MediaController.php
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class MediaController extends Controller
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
10
app/Media.php
Normal file
10
app/Media.php
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Media extends Model
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
41
database/migrations/2018_04_16_011918_create_media_table.php
Normal file
41
database/migrations/2018_04_16_011918_create_media_table.php
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class CreateMediaTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('media', function (Blueprint $table) {
|
||||||
|
$table->increments('id');
|
||||||
|
$table->unsignedInteger('status_id')->nullable();
|
||||||
|
$table->unsignedInteger('profile_id')->nullable();
|
||||||
|
$table->unsignedInteger('user_id')->nullable();
|
||||||
|
$table->string('media_path');
|
||||||
|
$table->string('cdn_url')->nullable();
|
||||||
|
$table->tinyInteger('order')->unsigned()->default(1);
|
||||||
|
$table->string('mime')->nullable();
|
||||||
|
$table->unsignedInteger('size')->nullable();
|
||||||
|
$table->timestamp('processed_at')->nullable();
|
||||||
|
$table->unique(['status_id', 'media_path']);
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('media');
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue