라라벨2-2일

라라벨2-2일

@yield('content')

{{-- content 라는 section 을 가진 코드에게 자리 양보 --}}

@extends('layouts.app')

@section('content')

블레이드 템플릿을 이용

@endsection

php artisan make:component PostList

명령 실행하면 component 폴더아래 blade (케밥클래스임 html 은 대소문자 구분안해서 ) . 와

app/view/components // 야ㅏ래에 PostList.php파일 생성

라라벨에서는 blade component 에다가 x- 붙여야 함

Route::resource('/posts', PostsController::class);

// post로 시작하는 모든 요청은 뒤에 컨트롤러가 실행할예정

php artisan make:controller PostsController

php artisan make:controller PostsController --resource

php artisan route:list ->>활성화된 route list

ORM 쓸래요!! MODEL만들기 - > DB table 만들기 - >

php artisan make:model Post -mf

migration 이랑 factory 까지만들어줌

-->> 새로운 db사용시 migrate error

1. .env 에서 사용할 디비 작성

2. php 폴더 안에서 php.ini 파일 ; 주석처리 풀기

factory 데이터 생성시

public function definition() 안에 넣기.

Post::factory()->count(3)->create();

Post::factory()->count(3)->make(); ->> db저장안됨이거

model 안에서

public function __construct($posts)

{

//

}

//인자로 props 데이터 받는것처럼.

컴포넌트에 전달,

컴포넌트와 연결된 클래스로

public으로 지정하면

그냥 호출도 가능

https://daisyui.com/components/table

이쁜css

from http://habbang0.tistory.com/69 by ccl(A) rewrite - 2021-09-02 19:26:11