- You have to have PHP version > 8
Brief
Laravel 9 has introduced several new features and improvements. Some of the main features of Laravel are:
- Anonymous stub migration feature which eradicates issues related to class name collisions instantly1.
- Improved themes on an exceptional page which allows you to customize or choose available themes at your convenience3.
Here’s an example of how you can use the new Query Builder Interface:
use Illuminate\Support\Facades\DB; $users = DB::table('users') ->where('name', 'John') ->orWhere('name', 'Jane') ->get();
In this example, we’re using theÂ
DB
 facade to query the users
 table and retrieve all users whose name is either “John” or “Jane”. The get()
 method returns a collection of user objects.Learn more:
New Functionalities
3. Improved Accessors and Mutators
- In Laravel 9.x you may define an accessor and mutator using a single, non-prefixed method.
public function name ( ) : Attribute return new Attribute ( get: fn ($value) => strtoupper ($value) , set: fn ($value) => $value, ); }
- Now we can use the same function to use in Accessors as well as Mutators
4. Controller Route Groups
- In previous version every time defining the route for the controller we have to write the controller_name:: class and with function name
- But in this version we can group the controller route
5. Full text Indexes / Where Clauses
When using MySQL, the fullText method may now be
added to column definitions to generate full text indexes:
$table—>text ( 'bio' ) —>fullText ( ) ;
The whereFullText and orWhereFullText methods may be used
to add full text "where" clauses to a query for columns
$users = DB::table('users') ->whereFullText('bio', 'web developer')->get();
6. Inline Blade template
suppose you have to generate a very small html template , so no need to create a view file instead you can write inline blade template
7. Checked or Selected Blade Directives
8. Bootstrap Pagination View
9. Implicit Route Binding
If you want only specific or predefined values can be able to be searched then you can define the enum such that
here the category can be either fruits or people
Â
10. test coverage
while testing your site you can now view the percentage of complition of the process