laravel (1)
laravel (1)
5. Development process requires you to work with standards and should have
real understanding of programming
6. Laravel is new framework and composer is not so strong in compare
to npm (for node.js), ruby gems and python pip.
7. Development in laravel is not so fast in compare to ruby on rails.
8. Laravel is lightweight so it has less inbuilt support in compare to django
and rails. But this problem can be solved by integrating third party tools,
but for large and very custom websites it may be a tedious task.
All Event classes are generally stored in the app/Events directory, while their
listeners are stored in app/Listeners of your application.
In Programming validations are a handy way to ensure that your data is always in
a clean and expected format before it gets into your database. Laravel provides
several different ways to validate your application incoming data. By default
ValidatesRequests trait which provides a
convenient method to validate all incoming HTTP requests coming from client.
You can also validate data in Laravel by creating Form Request.
Q5. How to install laravel via composer ?
PHP artisan is the command line interface/tool included with Laravel. It provides
a number of helpful commands that can help you while you build your application
easily. Here are the list of some artisan command:-
Below are list of some official/ default packages provided by Laravel 5.6
o Cashier
o Envoy
o Passport
o Scout
o Socialite
o Horizon
Route::get('user/profile', 'UserController@showProfile')->name('profile');
Once you have assigned a name to your routes, you may use the route's name
when generating URLs or redirects via the global route function:
// Generating URLs...
$url = route('profile');
// Generating Redirects...
return redirect()->route('profile');
Migrations
database schema.
// creating Migration
php artisan make:migration create_users_table
Composer is a tool for managing dependency in PHP. It allows you to declare the
libraries on which your project depends on and will manage (install/update) them
for you.
Laravel utilizes Composer to manage its dependencies.
Laravel Facades provides a static like an interface to classes that are available in
-ships with many facades which
use Illuminate\Support\Facades\Cache;
Route::get('/cache', function () {
return Cache::get('key');
});
with your database. Laravel provide many different ways to interact with your
database, Eloquent is most notable of them. Each database table has a
you to query for data in your tables, as well as insert new records into the table.
Below is sample usage for querying and inserting new records in Database with
Eloquent.
Q16. How to turn off CRSF protection for specific route in Laravel?
Yes, Laravel supports popular caching backends like Memcached and Redis.
By default, Laravel is configured to use the file cache driver, which stores the
serialized, cached objects in the file system.For large projects, it is recommended
to use Memcached or Redis.
Q18
You can use custom table in Laravel by overriding protected $table property of
Eloquent.
}
Q20. List types of relationships available in Laravel Eloquent?
o One To One
o One To Many
o One To Many (Inverse)
o Many To Many
o Has Many Through
o Polymorphic Relations
o Many To Many Polymorphic Relations
Q21. Why are migrations necessary?
o count()
o max()
o min()
o avg()
o sum()
Q45. In the laravel project folder, what is the .env file for?
Q46. What is in the config directory?
Q47. What is in the resources folder?
Q48. If you use "php artisan make:controller" to make a new controller, where is it
created?
Q49. In the laravel community, a RESTful controller is often referred to as...
( Resource Controller)
Q50. How would you get a list of all available routes?
Q51. What is the loop syntax in a blade template?
Q52. What blade function we use to tell the blade system what to place in a section of the
template?
Q53. how do you tell the system which layout to use?
@extends('layout.master')
Q54. Images, CSS and JS should be placed where?
Q55. If a model is named Todolist, what is the underlying database named?
todolists
The models are singular and the tables underneath are plural.
Q56. What command do you run to rollback a migration?