조회 : 610
$ php artisan make:migration simple_commentCreated Migration: 2019_01_09_050609_simple_comment
file : database/migrations/2019_01_09_050609_simple_comment.php
class SimpleComment extends Migration{ /** * Run the migrations. * * @return void */ public function up() { Schema::create('simple_comments', function (Blueprint $table) { $table->increments('sc_id'); $table->string('sc_name',50); $table->string('sc_pass',255); $table->text('sc_comment'); $table->timestamps(); // $table->timestamp('created_at'); // $table->timestamp('updated_at'); $table->timestamp('deleted_at')->nullable(); $table->rememberToken(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('simple_comments'); }}
$ php artisan migrateMigrating: 2019_01_09_050609_simple_commentMigrated: 2019_01_09_050609_simple_comment
Field Type Collation Null Key Default Extra Privileges Comment -------------- ---------------- ------------------ ------ ------ ------- -------------- ------------------------------- ---------sc_id int(10) unsigned (NULL) NO PRI (NULL) auto_increment select,insert,update,references sc_name varchar(50) utf8mb4_unicode_ci NO (NULL) select,insert,update,references sc_pass varchar(255) utf8mb4_unicode_ci NO (NULL) select,insert,update,references sc_comment text utf8mb4_unicode_ci NO (NULL) select,insert,update,references created_at timestamp (NULL) YES (NULL) select,insert,update,references updated_at timestamp (NULL) YES (NULL) select,insert,update,references deleted_at timestamp (NULL) YES (NULL) select,insert,update,references remember_token varchar(100) utf8mb4_unicode_ci YES (NULL) select,insert,update,references
$ php artisan make:model SimpleCommentModel created successfully.
file : app/SimpleComment.phpnamespace App;
use Illuminate\Database\Eloquent\Model;use Illuminate\Database\Eloquent\SoftDeletes;
class SimpleComment extends Model{ use SoftDeletes; protected $primaryKey ='sc_id'; //없을 경우 id 가 기본값 protected $dates = ['deleted_at'];}
$ php artisan make:controller SimpleCommentController -m SimpleComment -r --apiController created successfully.
routes/api.phpRoute::resource('sc', 'SimpleCommentController');
$ php artisan route:list+--------+-----------+------------------+------------+------------------------------------------------------+--------------+| Domain | Method | URI | Name | Action | Middleware |+--------+-----------+------------------+------------+------------------------------------------------------+--------------+| | GET|HEAD | / | | Closure | web || | GET|HEAD | api/sc | sc.index | App\Http\Controllers\SimpleCommentController@index | api || | POST | api/sc | sc.store | App\Http\Controllers\SimpleCommentController@store | api || | GET|HEAD | api/sc/create | sc.create | App\Http\Controllers\SimpleCommentController@create | api || | GET|HEAD | api/sc/{sc} | sc.show | App\Http\Controllers\SimpleCommentController@show | api || | PUT|PATCH | api/sc/{sc} | sc.update | App\Http\Controllers\SimpleCommentController@update | api || | DELETE | api/sc/{sc} | sc.destroy | App\Http\Controllers\SimpleCommentController@destroy | api || | GET|HEAD | api/sc/{sc}/edit | sc.edit | App\Http\Controllers\SimpleCommentController@edit | api || | GET|HEAD | api/user | | Closure | api,auth:api |+--------+-----------+------------------+------------+------------------------------------------------------+--------------+
제목 | 작성자 | 날짜 |
---|---|---|
공대여자 | ||
공대여자 | ||
mins01 | ||
공대여자 | ||
공대여자 | ||
공대여자 | ||
공대여자 | ||
공대여자 |