일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
- 체당금
- Blade
- 당사자표시정정신청서
- as후기
- 사업자계좌
- 코로나19
- auth
- Laravel
- elasticSearch
- reactnative
- Eclipse
- 보정명령
- 소액임금체불
- Bootstrap
- 개인사업자
- 전자소송
- Sentinel
- 코로나
- AWS
- vue
- Tutorial
- 이더리움
- cartalyst
- blockchain
- win32
- 인민공원
- Java
- javascript
- Python
- php
- Today
- Total
목록Development (102)
그냥 사는 이야기
Bootstrap 적용 Clean Blog theme 를 down 받는다. 그래서 모든 폴더(css, img, js, less, mail, vendor)를 public 밑으로 복사해 둔다. View 추가 resources/views/layouts/app.blade.php Toggle navigation Menu Study Home About Sample Post Contact @if (Auth::guest()) Members Login Register @else {{ Auth::user()->name }} Logout {{ csrf_field() }} @endif @yield('content') resources/views/auth/login.blade.php, register.blade.php @ext..
Post와 Comment 구현 Model App/Post class Post extends Model { protected $guarded = []; public function comments() { return $this->hasMany('App\Comment','on_post'); } public function author() { return $this->belongsTo('App\User','author_id'); } } App/Comment class Comment extends Model { protected $guarded = []; public function author() { return $this->belongsTo('App\User','from_user'); } public fun..
Setup database Auth 추가 php artisan make:auth database/migrations/CreateUsersTable $table->enum('role',['admin','author','subscriber'])->default('author'); php artisan migrate database seed 추가 database/seeds/DatabaseSeeder use App\User; class DatabaseSeeder extends Seeder { public function run() { $this->call(UsersTableSeeder::class); } } class UsersTableSeeder extends Seeder { public function ru..
Visitor 권한 우선 VisitorMiddleware를 만든다. php artisan make:middleware VisitorsMiddleware routes/web.php Route::group(['middleware' => 'visitors'], function() { Route::get('/register', 'RegistrationController@register'); Route::post('/register', 'RegistrationController@postRegister'); Route::get('/login', 'LoginController@login'); Route::post('/login', 'LoginController@postLogin'); }); visitor가 접근 할 ..
Admin Controller 추가 php artisan make:controller AdminController routes/web.php Route::get('earnings', 'AdminController@earnings'); AdminController public function earnings() { return 'Total earnings 999'; } Admin Middleware 추가 php artisan make:middleware AdminMiddleware App/Http/Middleware/AdminMiddleware.php use Sentinel; ... public function handle($request, Closure $next) { // 1. User should b..
roles 데이터 추가 Sentinel로 구성된 db에는 roles 라는 테이블이 존재한다. 여기에 2개의 data를 insert 하는데 slug, name column에 admin, Admin manager, Manager 이렇게 2개의 data를 insert 한다. role 부여 user를 register 할 때 이전 단계에서 생성했던 role중 manager role을 주는 방법은 RegistrationController public function postRegister(Request $request) { $user = Sentinel::registerAndActivate($request->all()); $role = Sentinel::findRoleBySlug('manager'); // 추가 $..
logout 구현 web.php Route::post('/logout', 'LoginController@logout'); LoginController public function logout() { Sentinel::logout(); return redirect('/login'); } top.menu.php @if(Sentinel::check()) {{ csrf_field() }} Logout @else Login Register @endif @if(Sentinel::check()) Hello, {{ Sentinel::getUser()->first_name }} @else Authentication with Sentinel @endif
Layout 구성 Bootstrap에서 Narrow Jumbotron template를 가져와서 layouts/master.blade.php에 만든다. master.blade.php @include('layouts.top-menu') @yield('content') top.menu.php Login Register Authentication with Sentinel login, register blade 수정 이제 layout을 bootstrap로 잡았으니 이를 적용한다. login.blade.php & register.blade.php 2파일 제거할 때 앞부분 div container까지 제거한다. @extends('layouts.master') @section('content') ... @endsec..