0% found this document useful (0 votes)
18 views

Laravel Commandes 1

This document outlines some basic Laravel concepts and commands including installing Laravel, generating models and controllers via Artisan commands, defining database migrations, routing requests, building controllers, and using middleware. It recommends the official Laravel documentation for more in-depth information on developing with the framework.

Uploaded by

Elliot
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Laravel Commandes 1

This document outlines some basic Laravel concepts and commands including installing Laravel, generating models and controllers via Artisan commands, defining database migrations, routing requests, building controllers, and using middleware. It recommends the official Laravel documentation for more in-depth information on developing with the framework.

Uploaded by

Elliot
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

*Installation:*

- composer create-project --prefer-dist laravel/laravel projectName: Creates a new Laravel project.

2. *Artisan Commands:*

- php artisan serve: Start the development server.

- php artisan migrate: Run database migrations.

- php artisan make:model ModelName -m: Create a model with a migration.

- php artisan make:controller ControllerName: Generate a new controller.

- php artisan make:middleware MiddlewareName: Create a new middleware.

- php artisan make:seeder SeederName: Generate a new database seeder.

- php artisan make:auth: Scaffold basic login and registration views and controllers.

3. *Database Migration:*

- Define database schema in migration files (database/migrations).

- Run migrations: php artisan migrate.

4. *Routing:*

- Define routes in routes/web.php (web routes) or routes/api.php (API routes).

- Example:

php

Route::get('/example', 'ExampleController@index');

5. *Controllers:*

- Controllers handle requests and define the application logic.

- Example:

php

class ExampleController extends Controller {

public function index() {

return view('example');
}

6. *Middleware:*

- Middleware provides a convenient mechanism for filtering HTTP requests.

- Register middleware in App\Http\Kernel.php.

- Example:

php

public $middleware = [

// ...

\App\Http\Middleware\CustomMiddleware::class,

];

These are fundamental commands and concepts, and there's a lot more to explore as you dive
deeper into Laravel development. The official Laravel documentation is an excellent resource for
detailed information: [Laravel Documentation](https://laravel.com/docs).

You might also like