Understanding Models And Views In Laravel 5.4

Submitted by azazqadir - 8 months ago

Models in Laravel 5.4 In Laravel, models are created inside the app folder. Models are mostly used to interact with database using Eloquent ORM. Eloquent provides simple ActiveRecord implementations for database interaction. 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. Source: https://www.cloudways.com/blog/models-views-laravel-5-4/

public function store(Request $request)
{
    $books = new Books();
    $books->name = $request->name;
    $books->category = $request->category;
    $books->category = $request->category;
    if($books->save()){
        return true;
    }
}

Ads cover the costs of maintaining Laravel-tricks

comments powered by Disqus

Ads cover the costs of maintaining Laravel-tricks