Commit 96273125 authored by mengyixi's avatar mengyixi

entrust_setup-tables

parents 78576625 adb160a9
<?php
/**
* Created by PhpStorm.
* User: Aladin
* Date: 2017/12/12
* Time: 13:10
*/
namespace App\Contracts;
interface FileServiceContract
{
public function getAll();
public function get($id);
public function delete();
}
\ No newline at end of file
<?php
namespace App\Http\Controllers;
use App\Contracts\FileServiceContract;
use Illuminate\Http\Request;
class FileController extends Controller
{
public function __construct(FileServiceContract $fileHandel)
{
$this->mFile = $fileHandel;
}
// 查询所有文件
public function getAll()
{
$this->mFile->getAll();
}
}
<?php
namespace App\Providers;
use App\Services\FileService;
use Illuminate\Support\ServiceProvider;
class FileServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
//
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
//绑定服务与接口关系
$this->app->singleton("App\Contracts\FileServiceContract",function(){
return new FileService();
});
}
}
<?php
/**
* Created by PhpStorm.
* User: Aladin
* Date: 2017/12/12
* Time: 13:14
*/
namespace App\Services;
use App\Contracts\FileServiceContract;
class FileService implements FileServiceContract
{
public function getAll()
{
dd(1);
}
public function get($id)
{
// TODO: Implement get() method.
}
public function delete()
{
// TODO: Implement delete() method.
}
}
\ No newline at end of file
......@@ -189,6 +189,7 @@ return [
App\Providers\PermissionServiceProvider::class,
App\Providers\TaskServiceProvider::class,
App\Providers\ScheduleServiceProvider::class,
App\Providers\FileServiceProvider::class,
Zizaco\Entrust\EntrustServiceProvider::class,
Orangehill\Iseed\IseedServiceProvider::class,
......
......@@ -22,6 +22,8 @@ class CreateFilesTable extends Migration
$table->unsignedInteger('group_id')->nullable();
$table->unsignedInteger('owner_id');
$table->unsignedInteger('creator_id');
$table->string('Bucket',191);
$table->string('pointer',191);
$table->softDeletes();
$table->timestamps();
});
......
......@@ -18,7 +18,8 @@ class CreateFoldersTable extends Migration
$table->string('name');
$table->unsignedInteger('parent_id');
$table->unsignedInteger('creator_id');
$table->unsignedInteger('owner_id');
$table->unsignedInteger('group_id');
$table->unsignedInteger('project_id');
$table->softDeletes();
$table->timestamps();
});
......
......@@ -29,8 +29,8 @@ class EntrustSetupTables extends Migration
->onUpdate('cascade')->onDelete('cascade');
$table->foreign('role_id')->references('id')->on('roles')
->onUpdate('cascade')->onDelete('cascade');
//$table->increments("id");
$table->primary(['admin_id', 'role_id']);
$table->increments("id");
$table->unsignedBigInteger(['admin_id', 'role_id']);
});
// Create table for storing permissions
......
......@@ -112,6 +112,12 @@ Route::get('/',function (){return view('login');})->name('admin.login');
Route::get('get_all','PermissionController@getAll')->name('permission.getAll');
});
Route::group(['prefix'=>'file'],function (){
Route::get('get_all','FileController@getAll')->name('file.getAll');
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment