분류 전체보기

· Laravel
https://keenthemes.com/metronic/ Metronic - The World's #1 Selling Bootstrap Admin Template by KeenThemes keenthemes.com 적용된 UIhttps://preview.keenthemes.com/starterkit/metronic/laravel/user-management/users
· Laravel
주요기능 // Adding permissions to a user $user->givePermissionTo('edit articles'); // Adding permissions via a role $user->assignRole('writer'); $role->givePermissionTo('edit articles'); $user->can('edit articles); @can('edit articles) @endcan 사용자 모델에 HasRoles 추가 use Illuminate\Foundation\Auth\User as Authenticatable; use Spatie\Permission\Traits\HasRoles; class User extends Authenticatable { use Ha..
laravel 에서 resources/css/app.css @tailwind base; @tailwind components; @tailwind utilities; 기본지식 : At-rules https://developer.mozilla.org/en-US/docs/Web/CSS/At-rule At-rules - CSS: Cascading Style Sheets | MDN At-rules are CSS statements that instruct CSS how to behave. They begin with an at sign, '@' (U+0040 COMMERCIAL AT), followed by an identifier and includes everything up to the next semico..
장점 : 별도의 css 파일을 만들지 않고 직접 html 파일에 적용한다. 따라서 style css 파일을 만들고 아주 귀찮은 이름짓기를 하지 않아도 된다. 화면 크기에 따라서 손쉽게 레이아웃을 변경할 수 있다. sm, md, lg, xl, 2xl 를 암기하자. 예제1. - 화면 크기에 따라서 글자 크기를 변경해 보자. 모바일 화면에서는 작고 pc 화면에서는 크게 보이도록.. 타이틀 제목입니다. 타이틀 제목입니다. 타이틀 제목입니다. 타이틀 제목입니다. 모바일에서 화면에서 보이는 글자 (모두 같은 크기로 보임) PC 화면에서 보이는 글자 (화면이 커질수록 글자 크기가 달라짐)sm:text-sm (화면크기 640px 이상일때만 text-sm 이 적용됨, 그보다 작은 경우는 기본 폰트 크기가 적용됨.) md..
· Laravel
위치 : app/Providers/RouteServiceProvider.php  Laravel 프레임워크 실행 순서. 1. /index.php2. bootstrap/app.php3. app/Http/Kernel.php4. config/app.php-> providers =[]; 의 내용을 읽어 들인다. 여기에 포함된 내용이 RouteServiceProvider 이다. 역할 : route 분배를 위해서 실행된다. route 파일은 여러개로 분리해서 정리할 수 있다. 예제1.// RouteServiceProviderRoute::middleware('web')  ->group(base_path('routes/post.php')); // /routes/post.phpRoute::controller(\App\H..
bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library? 해결책 pip install lxml
urllib3 v2.0 only supports OpenSSL 1.1.1+ 에러 해결 macOS 12.6.5의 시스템 Python은 ssl 모듈이 LibreSSL 2.8.3으로 컴파일된 Python 3.9.6입니다. urllib3 2.0에서 LibreSSL 지원이 제거되면 macOS에서 시스템 Python을 사용할 수 없게 됩니다. 해결방법 1. source ${project_path}/venv_path/bin/activate 2. (venv_examples) ..(project path, user name).. pip uninstall urllib3 3. pip install 'urllib3
· Laravel
라라벨에서는 개발을 위해서 데이타를 입력해야 하는것이 아니라, 테스트를 위한 데이타를 자동으로 입력시켜 주는 기능이 있다. Factory 를 데이타를 어떻게 입력할 것인가에 대한 정의이고 Seeder 는 Factory 에 정의된 내용으로 입력하는 동작을 한다. Factory 를 사용하기 위해서는 모델에 Factory 기능을 추가해야 한다. use Illuminate\Database\Eloquent\Factories\HasFactory; class User extends Authenticatable { use HasFactory; // ... } Factory 와 Seeder 생성하기 php artisan make:factory UserFactory php artisan make:seed UserSeede..
· Laravel
Resource 컨트롤러 간편하게 CRUD 를 구현하기 위해서 Resource Controller 를 만든다. php artisan make:controller PhotoController --resource php artisan make:controller PhotoController --model=Photo --resource // 가장 좋은 방법 php artisan make:model Photo -m php artisan make:controller PhotoController --model=Photo --resource --requests 위 명령어를 실행하면, 자동으로 컨트롤러에 CRUD 함수가 만들어진다. 리소스 컨트롤로는 간단하게 CRUD를 작성할 수 있고, 간단하게 라우딩 할 수 있다. ..
· Laravel
2가지 컨트롤러를 만들 수 있다. php artisan make:resource SampleResource php artisan make:resource SampleCollection 가장 기본 형태이다. 리스트와 조회가 가능한 형태로 가장 단순하고 편리한 형태이다. (이것만 사용해도 됨) app/Http/Resources/SampleResource.php class SampleResource extends JsonResource { public $preserveKeys = true; public static $wrap = 'sample'; /** * Transform the resource into an array. * * @return array */ public function toArray(Req..
· Laravel
Enum 을 이용한 권한을 구분하고 이를 이용해서 사용자의 API 권한을 설정하고 sanctum을 이용한 token 생성과 조회, 삭제 예제를 보여준다. Enum 생성 Enum 조회 Enum Validate 처리 Enum 생성하기 touch app/Enums/Ability.php 내용 입력 namespace App\Enums; enum Ability: string { case POST_CREATE = 'post:create'; case POST_READ = 'post:read'; case POST_UPDATE = 'post:update'; case POST_DELETE = 'post:delete'; } Controller 에서 데이타 넘기기 class TokenController extends Contr..
· Laravel
서비스 컨테이너(IoC Inversion of Control)는 객체의 생성 방법을 알고 있으며, 이를 대신해주고 필요한 곳에 주입해준다. ServiceProvider의 bind() 을 통해서 미리 설정된 객체를 연결시켜 둔다. 어떤 객체를 컨테이너에 요구하면 객체를 적절하게 생성해서 넘겨준다. 라라벨에서는 기본적으로 해결해주는 것도 있고 의존성 해결을 위해 바인딩을 거쳐야 하는 일도 있다. public function __invoke(Request $request) { return view('welcome'); } public function __invoke() { // $request = app(Request::class); $request = app->make(Request::class); retu..
에그티비
'분류 전체보기' 카테고리의 글 목록