๐ŸŒˆ Programming/Laravel

    [Laravel] Ajax๋กœ CRUD ๊ฒŒ์‹œํŒ ๋งŒ๋“ค๊ธฐ (1)

    ๐Ÿ“– MVC(Model View Controller) ๊ธฐ๋ณธ ์…‹ํŒ… 1. Laravel ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ ์šฐ์„  cmd ์ฐฝ ํ˜น์€ git bash ์—์„œ ๊ฒฝ๋กœ๋ฅผ ์ง€์ •ํ•œ ํ›„ ์ปดํฌ์ €๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ 8.x ๋ฒ„์ „์˜ ๋ผ๋ผ๋ฒจ ํ”„๋กœ์ ํŠธ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค. composer create-project laravel/laravel="8.x" ajax_crud 2. DB ์—ฐ๋™ ๋ฐ table, column ์ƒ์„ฑ ํ„ฐ๋ฏธ๋„์—์„œ artisan ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•˜์—ฌ ๋ชจ๋ธ, ๋งˆ์ด๊ทธ๋ ˆ์ด์…˜, ์ปจํŠธ๋กค๋Ÿฌ ํŒŒ์ผ์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค. php artisan make:model Student -mc Student.php ๋ชจ๋ธ ํŒŒ์ผ์„ ์—ด์–ด table ๋ฐ column ์—ฐ๋™ํ•ฉ๋‹ˆ๋‹ค.

    [Laravel] JSON with Ajax ๋ฆฌ์ŠคํŠธ ๋งŒ๋“ค๊ธฐ (1)

    ๐Ÿ“’ MVC(Model View Controller) ๊ธฐ๋ณธ ์…‹ํŒ… 1. Laravel ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ ์šฐ์„  cmd ์ฐฝ ํ˜น์€ git bash ์—์„œ ๊ฒฝ๋กœ๋ฅผ ์ง€์ •ํ•œ ํ›„ ์ปดํฌ์ €๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ 8.x ๋ฒ„์ „์˜ ๋ผ๋ผ๋ฒจ ํ”„๋กœ์ ํŠธ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค. composer create-project laravel/laravel="8.x" json_ajax_list2. Layouts ํด๋” ๋ฐ View ํŒŒ์ผ ์ƒ์„ฑ resources/views ํด๋” ์•ˆ์— layouts ํด๋”๋ฅผ ๋งŒ๋“  ํ›„ app.blade.php ํŒŒ์ผ์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค. @section('container') @show views ํด๋” ์•ˆ์— ๋ฉ”์ธ ํ™”๋ฉด์œผ๋กœ ์‚ฌ์šฉํ•  index.blade.php ํŒŒ์ผ์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค. @extends('layouts.app') @sect..