1. user을 만드는 부분이다. (등록,수정,삭제를 할 수 있다.)


app/Nova/User.php 이렇게 연결 되어있나보다.



2. 마이그레이션과 모델 파일을 만들어주자 여기서는 각각 만들겠다.


posts 마이그레이션 파일을 하나 만들어주자

1
php artisan make:migration create_posts_table --create=posts
cs



1
2
3
4
5
6
7
8
9
    public function up()
    {
        Schema::create('posts', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('title');
            $table->text('body');
            $table->timestamps();
        });
    }
cs



1
php artisan make:model Post
cs



마이그레이션 해준다. php artisan migrate



3. 터미널에서 php artisan nova:resource Post 입력하자.


Nova/Post.php 파일이 생성되었다.


Posts 라는 메뉴가 생성되었다.


app/Nova/Post.php 에서 소스를 수정한다.

1
public static $title = 'title';
cs


1
2
3
   public static $search = [
        'id', 'title', 'body'
    ];
cs


1
2
3
4
5
6
7
8
9
10
    public function fields(Request $request)
    {
        return [
            ID::make()->sortable(),
 
            Text::make('Title')->sortable(),
 
            Trix::make('Body')->sortable(),
        ];
    }
cs


상단에 아래와 같이 넣어주길...

1
2
3
4
use Illuminate\Http\Request;
use Laravel\Nova\Fields\ID;
use Laravel\Nova\Fields\Text;
use Laravel\Nova\Fields\Trix;
cs


Fields 명을 변경하고 싶은경우 

1
 Number::make('사용자정의 이름','테이블명'),
cs



4. 아래와 같이 나오면 된다.


글을 작성하면 잘 입력된다.



5. 만약 사이드바에 보여지게 하지 않을려면 

해당 Nova/Post.php 파일에서 아래와 같이 소스를 넣으면 된다.


1
public static $displayInNavigation = false;
cs



아래와 같이 사이드에서 자원메뉴가 없어졌다.


메뉴를 그룹으로 만들 수 도 있음.

1
public static $group = 'Admin';
cs


페이지 매김 사용자 정의

1
 public static $perPageOptions = [10, 100, 150];
cs


+ Recent posts