Skip to content

Instantly share code, notes, and snippets.

@azazqadir
Created March 9, 2018 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azazqadir/5d8d818ca440c1842db81de386a077ca to your computer and use it in GitHub Desktop.
Save azazqadir/5d8d818ca440c1842db81de386a077ca to your computer and use it in GitHub Desktop.
Learn more about Models and View in Laravel 5.5

In Laravel, models are created inside the app folder. Models are mostly used to interact with the database using Eloquent ORM. Eloquent provides simple ActiveRecord implementations for database interaction.

The easiest way to create a model is the Artisan command:

php artisan make:model <model name>

Views in Laravel are created in the resources/views folder. You can change base path for views by editing config/view.php file and changing realpath(base_path('resources/views')) to the new location for the views.

Laravel offers a simple view that routes to home. Loading a view in the controller is easy. You just need to add view(‘viewname’) method while returning from the controller method.

public function index()
{
    return view('home');
}

Read full article at: Working with and Creating Model and View in Laravel 5.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment