{"flag":true,"single":true,"pageTitle":"Basics of laravel, simple application creation","post":{"id":2,"user_id":"1","slug":"basics-of-laravel-simple-application-creation-gza4","title":"Basics of laravel, simple application creation","body":"<p><strong>1. Create controller<\/strong><\/p>\r\n<pre class=\"language-markup\"><code>php artisan make:controller HomeController<\/code><\/pre>\r\n<p>OR below command to create all model, controller, migrations, &nbsp;<strong>php artisan make:model Home,<\/strong> php artisan make:migration create_homes_table ,<strong>php artisan make:controller HomeController <\/strong>--resource<\/p>\r\n<pre class=\"language-markup\"><code>php artisan make:model Home -mcr<\/code><\/pre>\r\n<p>it will create controller and you can make functions<\/p>\r\n<pre class=\"language-markup\"><code>&lt;?php\r\n\r\nnamespace App\\Http\\Controllers;\r\n\r\nuse Illuminate\\Http\\Request;\r\n\/\/use App\\Models\\User;\r\n\r\nclass HomeController extends Controller\r\n{\r\n    public function index(){\r\n\t\techo \"L\";\r\n\t}\r\n}<\/code><\/pre>\r\n<p><strong>2. Add route into <\/strong>routes\/web.php<\/p>\r\n<pre class=\"language-markup\"><code>Route::get('message',[App\\Http\\Controllers\\HomeController::class,'index'])-&gt;name('message');\r\n\/\/Route::get('urlName','Controller','functionName')-&gt;name('routeName');<\/code><\/pre>\r\n<p><strong>3. View create <\/strong>file.blade.php<\/p>\r\n<p>goto resources\/views\/ and create new file like index.blade.php<\/p>\r\n<pre class=\"language-markup\"><code>&lt;h1&gt;First view &lt;\/h1&gt;<\/code><\/pre>\r\n<p><strong>4. How to call view inside controller<\/strong><\/p>\r\n<pre class=\"language-markup\"><code>public function index(){\r\n\treturn view('index');\r\n}<\/code><\/pre>\r\n<p><strong>5. How to send data in view&nbsp;<\/strong><\/p>\r\n<pre class=\"language-markup\"><code>public function index(){\r\n\t\t$msg = \"laravel message\";\r\n\t\treturn view('index',compact('msg')); \/\/ you can send array etc here\r\n\t}<\/code><\/pre>\r\n<p><strong>FOR DATABASE<\/strong><\/p>\r\n<ol>\r\n<li><strong>configure .env file<\/strong><\/li>\r\n<li><strong>run command<\/strong>\r\n<pre class=\"language-markup\"><code> php artisan migrate<\/code><\/pre>\r\n<\/li>\r\n<\/ol>\r\n<p>&nbsp;<\/p>","category_id":"2","is_private":"0","created_at":"2023-03-14T04:09:19.000000Z","updated_at":"2026-02-04T06:48:32.000000Z","category":{"id":2,"user_id":"1","name":"Laravel Core","slug":"laravel-nhyt","parent_id":"1","created_at":"2023-03-14T03:58:27.000000Z","updated_at":"2023-03-20T11:30:50.000000Z"},"user":{"id":1,"name":"R GONDAL","email":"rizikmw@gmail.com","email_verified_at":null,"two_factor_confirmed_at":null,"current_team_id":"1","profile_photo_path":null,"created_at":"2023-03-12T10:49:33.000000Z","updated_at":"2025-01-10T12:59:00.000000Z","profile_photo_url":"https:\/\/ui-avatars.com\/api\/?name=R+G&color=7F9CF5&background=EBF4FF"}},"pageDesc":"1. Create controller php artisan make:controller HomeController OR below command to create all model, controller, migrations, &nbsp;php arti - Basics of laravel, simple application creation (Updated: February 4, 2026) - Read more about Basics of laravel, simple application creation at my programming site [SITE]","categories":[]}