#laravel 5.8 named routes
Explore tagged Tumblr posts
Text
Laravel 5.8 Tutorial From Scratch - e24 - URL Helpers - Laravel
Laravel 5.8 Tutorial From Scratch â e24 â URL Helpers â Laravel
Laravel 5.8 Tutorial From Scratch â e24 â URL Helpers â Laravel
[ad_1]
In this episode, we explore the 3 URL Helpers offered by Laravel out of the box and refactor our project to use them.
For the best experience, follow along in our interactive school at https://www.coderstape.com
Resources Course Source Code https://github.com/coderstape/laravel-58-from-scratch
Hit us up on Twitter with anyâŠ
View On WordPress
#laravel 5 auth#laravel 5.8#laravel 5.8 authentication#laravel 5.8 feature#laravel 5.8 features#laravel 5.8 multi auth#laravel 5.8 named resource routes#laravel 5.8 named routes#laravel 5.8 user auth#laravel 5.8 user authentication#laravel auth#laravel authentication#laravel from the ground up#laravel middleware#laravel named resource routes#laravel named routes#laravel registration#laravel route group middleware#laravel routing with parameters
0 notes
Text
Laravel 6.0: What You Should Know
Since the inception of Laravel 5.0 around 4.5 years ago, the Laravel ecosystem has blossomed into something that leaves users nothing to complain about, to say the least. Laravel Nova, Laravel Horizon, Laravel Echo, Laravel Scout, and Laravel Passport are just some of the tools that have been introduced since then. At the time of this writing, weâre on Laravel 5.8 and Taylor Otwell has decided to skip past 5.9 on to 6.0 on the 3rd of September. Previously, Taylor has stressed that this wonât be a major paradigm shift for Laravel and the most significant change will be the transition to semantic versioning. However, this doesnât mean that there arenât plenty of new features worth talking about.
Letâs dive into some of the smaller changes first.
The Smaller Things
Authorization
Authorization messages can now be made easier for users to understand. Before Laravel 6.0, the infrastructure wasnât in place to easily give a specific response to a user when they were given an authorization-related error. The status code could be given fairly easily, but giving a custom error message was more complicated back then. Giving a custom messaged required the developer to create a new file and write their own exceptions.
Now, to get a customizable authorization response, you can simply use the Gate::inspect method when linking to the function that enables you to receive the response. Delivery of the message to the front-end is also easy to organize. Simply add $this->authorize or Gate::authorize to a suitable route or controller.
No More Default Front-End
The typical front-end setup you are given when you first start a Laravel project is now gone. This means the Vue and Bootstrap code you would usually see, would have now been removed. What itâs been replaced with is unknown. Perhaps, it hasnât been replaced. Strangely, the make:auth command, used to provide the login system scaffolding is now not a part of the original Laravel install either. To be honest, the rationale behind this change is unclear to me. However, given Laravelâs versioning adjustment, it makes sense that third-party technologies like Vue and Bootstrap that havenât recently undergone the same changes could cause conflict. Though, this is merely speculation.
If you want access to the old UI, you can extract a composer package that contains it with the CLI: composer require laravel/ui and php artisan ui vue --auth.
Lazy Collections
This is one of the more interesting additions. If youâre new to Laravel, Collections are tools that make it easier for you to manipulate arrays. Eloquent, one of the two main tools in Laravel used to communicate with databases, returns its queries as Collection instances. Check out the docs for Collections if you think youâre gonna lack context in a moment. https://laravel.com/docs/5.8/collections
So, what are Lazy Collections? Traditional Collections are often used for working with large amounts of data. When they run into data-heavy files, theyâll try and store all of that data at once. This may sound quick and convenient but the downside is that this is very memory-taxing. Lazy Collections solve this problem by only storing the part of the file they need, and thus, save memory usage and boost performance.
If you understand how lazy loading works then youâll be familiar with my previous explanation. Lazy loading works the same way. When you make a request to the server with lazy loading implemented, the browser will only return the part of the web page it knows youâre going to use immediately. Then, when the user scrolls down the page or clicks on an internal link, the server will provide you the necessary content it knows you need. This way, only memory that is needed at that particular moment is being used. This method increases speed. Lazy Collections is kind of like lazy loading but with arrays from a database and not content on a webpage.
The Bigger Things
Laravel Ignition
So yeah, the new error page for Laravel is called Ignition and it looks awesome. Itâll be the default error page for Laravel when 6.0 releases. However, if you donât feel like making the switch to 6.0 just yet, thatâs fine, you can still install Ignition on previous versions. Letâs talk about what Ignition brings to the table.
With Whoops (the current default Laravel error page), stack traces and relevant code snippets are shown in an error page, but this doesnât always lead the developer to the solution. Worse, sometimes the stack traces just reference compiled paths. This can it make it difficult to find the necessary non-compiled files to fix because they arenât listed anywhere on the error page. Thankfully, this isnât a problem with Ignition, it can display to you the non-compiled file where the problem actually exists. By clicking on a pencil icon, you can go directly to the file in your chosen editor.
The second coolest feature of Ignition is that it can display potential solutions when displaying an error message. Most error pages just leave you with the error. For example, if the error is that you misspelled a property name, Ignition will tell you that the property has been misspelled and offer you the correct spelling. Solution suggestions can be way more sophisticated than this, Iâll link you to the source down below. Your suggestions are even customizable!
You wanna know the coolest feature? These solution suggestions are actually runnable!
Yes, really. Take a look at this short demo by one of the creators, Freek Van der Herten.
https://youtu.be/EZu0-CwTU9Q
Also, you can add your own runnable solutions too! This is great as Ignition is open source so people in the Laravel community will undoubtedly contribute their own solutions for everyone to use.
Thereâs a bunch of other cool features too such as creating your own tabs (yes Ignition has tabs) and sharing your error messages with other people. This is done using Flare, a tool that comes with Ignition.
For everything about Laravel Ignition and Flare, visit https://freek.dev/1441-ignition-a-new-error-page-for-laravel.
Laravel Vapor
Another big one. Laravel Vapor is a serverless deployment platform for Laravel. But wait, why do we need a deployment platform? We already have Laravel Forge, right? As beloved as Forge is amongst the Laravel community, it does have its limitations. It doesnât have autoscaling to deal with large sudden increases in traffic that prevent your site from crashing. Also, configuration is required when OS or PHP updates occur. Vapor has autoscaling, so, you donât have to worry about sudden spikes in your traffic causing website downtime. In addition, because of the serverless structure of Vapor, it also handles all the updates you may stress about when using Forge.
Vaporâs website is very clean looking and everything seems easy to find. When you deploy a project, you can see the different stages of the deployment process loading on the UI. I find this to be very reassuring and comforting. You can also rollback your application with a click of a button. Just click on ârollbackâ and itâll do just that. Pretty neat. Same deal if you want your app to undergo maintenance. Just click on the âmaintenance modeâ button.
Another cool feature of Laravel Vapor is that youâre able to set alarms. What do I mean by that? For example, to know when your website traffic suddenly blows up, you can set a certain amount of HTTP requests per minute, and if your website hits that limit, the alarm will go off, informing you of the surge in traffic. Taylor Otwell showcases this and other conditionals in his Laravel Vapor demo which Iâll link to below.
Thereâs so much to cover with Laravel Vapor and the Laravel update itself. Because of this, I didnât really want to dive into the complexities too much in this post. To learn more about the technical aspects of Laravel 6.0, you can take a look at the release notes here https://laravel.com/docs/6.0/releases. For more info on Laravel Vapor, visit this video by Taylor Otwell https://www.youtube.com/watch?v=XsPeWjKAUt0&t=362s.
1 note
·
View note
Link
Here is another interesting topic of guard in laravel we are going to cover in this post. As we all know user authentication can be achieved in jiffy, that is, run php artisan make:auth and you will get controllers, blade views all ready to launch with authentication.
But..but.. Here is the catch. Laravel provides default authentication on User model or users table, what if there are two types of users completely different to each other, for example application users and admins ?
One thing we can do is, make a column in users table with name as type and there we define type of user, 1 for admin and 0 for normal user. This method is completely wrong, do not do this ever. Period.
Keep normal users in user table and for admins create another table as admin. Laravel ships a default authentication guard called as web which is applied on User model. For instance go to config/auth.php
'defaults' => [ Â Â Â Â 'guard' => 'web', Â Â Â Â 'passwords' => 'users', Â Â ],
Table of Contents
What is a guard in laravel authentication?
Create middlewares for normal users and admin users routes
Register middlewares in Kernel.php
Apply middlewares on their respective routes in web.php
Conclusion
How to create a guard a in laravel ?
What is middleware in laravel ?
#slideshare#laravel#guard#authentication#API#endpoints#endpoint security#reddit#medium#blog#tutorial#php#php programming#web development#decodewebin#developers & startups#web development tutorial for beginners#html tutorial for beginners
0 notes
Link
ã¯ããã« çæ§ããã«ã¡ã¯ãOPTiMæ°å1幎ç®ãšã³ãžãã¢ã®éæšã§ãã ååã¯æ©æŒããã¿ã³ãªãããäœã£ãŠããŸããã tech-blog.optim.co.jp ä»åã¯ãPHP ãã¬ãŒã ã¯ãŒã¯ã® Laravel ããPostgreSQL ãš Vue.js ãšçµã¿åãããŠäœæãã TODO ã¢ããªãéããŠç޹ä»ããŸãã ãã®ãã¬ãŒã ã¯ãŒã¯ãã¯ãã¡ãã®èšäºã§ãå¯ãã«å©çšããŠããŸãã tech-blog.optim.co.jp OPTiMã§ã¯ããŸãå©çšãããŠããŸããããäžéšã®ã¢ããªã±ãŒã·ã§ã³ã§å®å©çšãããŠããç®æãããããŸãã PHPã¯æã®ã€ã¡ãŒãžããããªãé¿ï¿œï¿œãããŠããŠããŸãã...ä»ã®PHPãšãã®ãã¬ãŒã ã¯ãŒã¯ã¯ãããçºå±ããŠããŠãšãŠã䜿ããããã®ã§æ¯é䜿ã£ãŠããã ãããïŒãšããæ°æã¡ããããŸãã ã§ãããçŸç¶ã¯ããŸãå©çšããŠããã ããªããŠå人çã«ã¯æ²ããæ°æã¡ã§ãã£ã±ãã§ãã ãããªPHPã§ããããã¬ãŒã ã¯ãŒã¯ïŒLaravelãFuelPHPãªã©ïŒãå©çšããããšã«ããæªå©çšæãããé«éãã€å®å
šã«éçºããããšãã§ããŸãã ãããªãã¬ãŒã ã¯ãŒã¯ã®ç޹ä»ããTODOãªã¹ãã¢ããªã±ãŒã·ã§ã³ããäœããªããèŠãŠãããŸãããã PHPãã¬ãŒã ã¯ãŒã¯ãLaravelã ä»åã玹ä»ããã®ã¯PHPãã¬ãŒã ã¯ãŒã¯ã®ãLaravelãã§ãã Laravel - The PHP Framework For Web Artisans laravel.jp ãã¬ãŒã ã¯ãŒã¯ã®ä»æ§ã«ä¹ã£ãã£ãŠéçºããããšã«ããããªãå®å
šã§å¯çšæ§ã®ããã¢ããªã±ãŒã·ã§ã³ã®éçºã容æã«ãªããŸãã å人çã«Laravelã®ãããšããã¯ãºã㪠çéå®å
šéçº ã§ãã æ¬åœã«ææ©ãWebã¢ããªã±ãŒã·ã§ã³ãäœããŸãã ä»ãŸã§æ°äººã§äœæ¥ããŠãããã®ããã£ãäžäººã§1é±éãããã°ããªã匷ãç©ãäœããŸãïŒ 2019幎8æ5æ¥çŸåšã®Laravelææ°ããŒãžã§ã³ã¯ã5.8ãã§ã5.7ãã®ãã€ããŒã¢ããããŒããšãªã£ãŠããŸãã Laravelã¯å¥æ°ããŒãžã§ã³ãã¡ã€ã³ãšãªã£ãŠãããäžã§ãLTSãšãªã£ãŠããã®ã¯ã5.1ãã5.5ããšãªã£ãŠããŸããã»ãã¥ãªãã£ãã£ãã¯ã¹æéã¯LTSã§3幎éãäžè¬çãªãªãªãŒã¹ã«ã€ããŠã¯1幎éã®ãµããŒããšã¡ã³ããã³ã¹ããããŠããŸãã ãã®ããã«ãèšèªä»æ§ã ãã§ã¯ã«ããŒã§ããªãã»ãã¥ãªãã£ã®æ
ä¿ããã¬ãŒã ã¯ãŒã¯ãæ
ã£ãŠãããããšã«ãããPHP5以åã®æä»£ãããé¥ãã«åŒ·ããªã£ãŠããŸãã ããã§ãGoogleãã¬ã³ãããæ³šç®åºŠãæ¯èŒããŠã¿ãŸãããã å®ã¯ä»£è¡šçãªWebãã¬ãŒã ã¯ãŒã¯ã®ãRuby on RailsãããDjangoããªã©ãããLaravelã®æ³šç®åºŠãäžãã£ãŠããŠããŸãã æ¥æ¬ã§ã¯ãã³ããã§ãRuby on Railsããå€ãèŠãããŸãã æµ·å€ã§ã®ãLaravelãã®æ³šç®åºŠãäžãã£ãŠããŠããããã§ããã Laravelã¯æ©èœããšãŠãè±å¯ã§ããã§ããããã¡ã€ã«ãµã€ãºçã«ã倧ãããªããŸãããç°å¢ã«ãè² æ
ãããã£ãŠããŸããŸãã ãããªæã¯ãLumenããå©çšããŸããããããã§ã¯ããŸã解説ããŸãããããLumenãã¯ãLaravelãã®è»œéçãšããŠéçºãããŠããŸãã ãšã£ãŠãéã«èª¬æãããšNode.jsã®Expressã®ãããªæãã§ããã ããŠãå眮ããé·ããªããŸããããæ¬é¡ã«ç§»ããããšæããŸãã ä»åã®ç®æš PHPãã¬ãŒã ã¯ãŒã¯Laravelã§ãDBã䜿çšããSPAïŒSingle Page ApplicationïŒã®TODOã¢ããªãäœããŸãã ãŸããã°ã€ã³èªèšŒã«ãããŠãŒã¶ç®¡çãåæã«è¡ã£ãŠãããŸãã å®æåœ¢ ãã®èšäºã®æåŸã«ã¯ãã®ãããªã¢ããªã±ãŒã·ã§ã³ãåºæ¥äžãããŸãã ãŠãŒã¶ã®æ°èŠç»é²ã»ãã°ã€ã³ã»ãã°ã¢ãŠã ãã°ã€ã³ãŠãŒã¶ããšï¿œï¿œTODOã®è¡šç€ºã»è¿œå ã»æŽæ°ã»åé€ æäœéã®View 䜿çšããæè¡ PHP Laravel Vue.js PostgreSQL Docker å°å
¥ã»ç°å¢æ§ç¯ PHPã®å°å
¥ Laravelã§ããŒãžã§ã³ããšã«PHPã«å¯ŸããèŠä»¶ã決ããããŠããŸãã çŸæç¹ã§ã®PHPã®ææ°ããŒãžã§ã³ã¯ã7.3.8ã çŸæç¹ã§ã®Laravelã®ææ°ããŒãžã§ã³ã¯ã5.8.17ã Laravelã5.8.*ãã§æ±ããããPHPã®èŠä»¶ã¯ä»¥äžã®ãšããã§ãã = 7.1.3 BCMath PHPæ¡åŒµ Ctype PHPæ¡åŒµ JSON PHPæ¡åŒµ Mbstring PHPæ¡åŒµ OpenSSL PHPæ¡åŒµ PDO PHPæ¡åŒµ Tokenizer PHPæ¡åŒµ XML PHPæ¡åŒµ ããã«å¿ããŠPHPã®å°å
¥ãè¡ããŸãããã ã¡ãªã¿ã«Homebrewã§ã€ã³ã¹ããŒã«ããå Žåã¯ã7.3.7ããã€ã³ã¹ããŒã«ãããŸããããã¡ãã®ããŒãžã§ã³ã§ãèŠä»¶ãæºãããŠãããŸãã®ã§å€§ããªåé¡ã¯ãããŸããã â»ãã ãã»ãã¥ãªãã£çã®é¢ä¿äžææ°ããŒãžã§ã³ã䜿ãã«è¶ããããšã¯ãããŸãããäžèª¿ã¹ã¯æ
éã«ãã€å¿µå
¥ãã«è¡ããŸãããã Composerã®å°å
¥ Laravelãæ§ç¯ããããã®ããã±ãŒãžãããŒãžã£ãå¿
èŠãšãªããŸãã PHPã®ä»£è¡šçãªããã±ãŒãžãããŒãžã£ã§ãããComposerããå°å
¥ããŸãããã curl -sS https://getcomposer.org/installer | php sudo mv composer.phar /usr/local/bin/composer composer config -g repositories.packagist composer https://packagist.jp HelloWorldïŒãããžã§ã¯ãã®äœæïŒ ããŠããããããããžã§ã¯ããäœæããŠãããŸãã ãLaravelãã§ã¯ä»¥äžã®1ã³ãã³ãã®ã¿ã§ãããžã§ã¯ãã®æ°èŠäœæãè¡ããŸãã $ composer create-project laravel/laravel Techblog_sample ãã«ãã€ã³ãµãŒãã®èµ·å Laravelã«æšæºæèŒãããŠããartisanã³ãã³ãã§ãã«ãã€ã³ãµãŒããèµ·åããŠã¿ãŸãããã ç°¡åã§ãããç°å¢æ§ç¯åŸããã¯ãã£ã3ã³ãã³ãããå©ããŠããŸããããHelloWorldåçã®ç»é¢ãŸã§åºããŸããã ããŒã¿ããŒã¹ã®å°å
¥ãšAuthå®è£
ããŒã¿ããŒã¹ã®å°å
¥ãè¡ããŸãã ä»åã¯PostgreSQLãå©çšããŠããŸãããMySQLãSQLiteãªã©ã察å¿ããŠããŸãã PostgreSQLå°å
¥ (Docker䜿çš) LaravelãšDBã®æ¥ç¶ AuthïŒèªèšŒïŒå°å
¥ PostgreSQLå°å
¥ (Docker䜿çš) PostgreSQLãæ§ç¯ããŸãã ãã¡ãã¯çæ§ã®ã奜ããªæ¹æ³ã§æ§ç¯ããŠããã ããŠæ§ããŸããã ãããŸã§äžäŸãšããŠèšèŒããããŸãã ããŒã¿ããŒã¹ãéçºæ©ã«ãã®ãŸãŸæ§ç¯ããŠãè¯ãã§ãããæ¯èŒçæ§ç¯ã®ç°¡åãªdocker-composeãå©çšããŠæ§ç¯ãããããšæããŸãã docker-compose.yml version: '2' services: db: image: postgres:11-alpine ports: - "15432:5432" environment: POSTGRES_USER: "postgres" POSTGRES_PASSWORD: "password" POSTGRES_DB: "techblog" 5432/tcp ããŒã¿ããŒã¹ã®æ§ç¯ãçµãããŸãᅵᅵã LaravelãšDBã®æ¥ç¶ LaravelãšDBãµãŒããæ¥ç¶ããŸãã ãã¡ãã¯ããã©ã«ãã§ç°å¢å€æ°ããæ¥ç¶æ
å ±ãååŸããããã«ãªã£ãŠãããç°å¢å€æ°ã倿Žããããšã«ããæ¥ç¶æ
å ±ãæŽæ°ã§ããŸãã ãŸããç°å¢å€æ°ã«ååšããªãã£ãå Žåã¯ãã£ã¬ã¯ããªã«ååšãã.envãã¡ã€ã«ãåç
§ããããã«ãªã£ãŠããŸãã .envãã¡ã€ã«ã以äžã®ããã«å€æŽããŠãã ãããåèªã§æ§ç¯ãããå Žåã¯æ§ç¯ãᅵᅵéã®æ
å ±ã«éœåºŠå€æŽããŠãã ããã .env ... DB_CONNECTION=pgsql DB_HOST=127.0.0.1 DB_PORT=15432 DB_DATABASE=techblog DB_USERNAME=postgres DB_PASSWORD=password ... æ¥ç¶ç¢ºèªã¯æ¬¡ã®Authäœææã«ç¢ºèªããŸãã AuthïŒèªèšŒïŒå°å
¥ Laravelã«AuthïŒèªèšŒïŒã远å ããŸãã è³ã£ãŠç°¡åã§ãã $ php artisan make:auth Authentication scaffolding generated successfully. 以äžã§ãã 詊ãã«ãã«ãã€ã³ãµãŒããç«ã¡äžãã確èªãããŠã¿ãŸãããã ãæ°ã¥ãã®æ¹ãæ¢ã«ããã£ããããããããŸããããå³äžã«ãã°ã€ã³ãã¿ã³ãªã©ãçŸããŠããŸãã 詊ãã«ãã°ã€ã³ãã¿ã³ãæŒããŠã¿ãŸãããã ãã°ã€ã³ç»é¢ãæ§ç¯ãããŠããŸãã ãã£ã1ã³ãã³ãã§ ãã°ã€ã³ç»é¢ æ°èŠç»é²ç»é¢ ãã¹ã¯ãŒããªã»ããç»é¢ ãå®è£
ãããŸãã çŽ æŽãããã§ããã ãã ãããŸã®ãŸãŸã§ããšDBã«ã¢ã¯ã»ã¹åºæ¥ãŠããŸããã 以äžã®ã³ãã³ããå
¥åããŠãã€ã°ã¬ãŒã·ã§ã³ãè¡ããŸãããã $ php artisan migrate Migration table created successfully. Migrating: 2014_10_12_000000_create_users_table Migrated: 2014_10_12_000000_create_users_table Migrating: 2014_10_12_100000_create_password_resets_table Migrated: 2014_10_12_100000_create_password_resets_table ããã§æ°èŠç»é²ãªã©ãåºæ¥ãããã«ãªããŸããã ããã©ã«ãã§ã¯ã»ãã·ã§ã³ã§ãã°ã€ã³æ
å ±ã管çããŸãã ã³ãã³ãã©ã€ã³ïŒTinkerïŒã§DBããŒã¿ç¢ºèª artisanã³ãã³ãã«ããããŒã¿ç¢ºèªãè¡ã£ãŠã¿ãããšæããŸãã Laravelã«ã¯ããã©ã«ãã§tinkerãšåŒã°ãã察話åããŒã«ãååšããŸãã ãã¡ããå©çšããããšã«ããããœãŒã¹ã³ãŒãã«ããåã«åäœç¢ºèªãåºæ¥ãŸãã ãŸããLaravelã«èªã¿èŸŒãŸããã¢ãžã¥ãŒã«çãæåã§èªã¿èŸŒããç¶æ
ã«ãªã£ãŠããã®ã§ãLaravelã§éçºããéã¯ããããã®åäœç¢ºèªæ¹æ³ã§ãã LaravelããDBã«ã¢ã¯ã»ã¹ããããã«ãã¯ãšãªãã«ããå©çšããŸãã äœæ¥ããããã®ãŸãã« ããŒã¿ããŒã¹ã«ããŒã¿ãå
¥ãããããäžæŠç»é¢äžããæ°èŠç»é²ãè¡ã£ãŠã¿ãŸãããã ãã£ãããšæ°èŠç»é²ãããŠããŸããã ãŸãããããã£ãäºããããã°ãšããŠå©çšã§ããŸãã false ã³ãã³ãã©ã€ã³äžã§ã»ãã·ã§ã³ãå©çšã§ãããšããããšã§ããã ç¬èªã§äœæãããµãŒãã¹ã¢ãžã¥ãŒã«ãªãããå©çšåºæ¥ãã®ã§ãæ¯éãããã°ãªã©ã«ãå©çšãã ããã ããŒãã«èšèš TODOã¢ããªã±ãŒã·ã§ã³ãå¶äœããã«åœãã£ãŠããŒãã«ãæ§ç¯ããªããã°ãããŸããã ä»åã¯ïŒãŠãŒã¶ãè€æ°ã®TODOãæãŠãããã«èšèšããŸãã ããŒãã«èšèšã¯åé
ã§ãå©çšãã Migration ãå©çšããŸãã $ php artisan make:migration create_todos_table Created Migration: 2019_08_05_065824_create_todos_table database/migrations/2019_08_05_065824_create_todos_table.php <?php public function up() { Schema::create('todos', function (Blueprint $table) { $tablebigIncrements('id'); $tablestring('todo'); // ãã®è¡ã远å $tableinteger('user_id'); $tabletimestamps(); }); } public function down() { Schema::dropIfExists('todos'); } äœæã§ãããããã€ã°ã¬ãŒã·ã§ã³ãå®è¡ããŠããŒã¿ããŒã¹ã«åæ ãããŸãããã $ php artisan migrate Migrating: 2019_08_05_065824_create_todos_table Migrated: 2019_08_05_065824_create_todos_table ããã§æ°ãã«ããŒãã«ãäœæãããŸããã ãããŸã§ ãããŸã§ã¯Laravelã®å°å
¥ãç°å¢æ§ç¯ãAuthã®å°å
¥ãè¡ããŸããã PHPã§ã®ã³ãŒãã£ã³ã°ãã»ãŒç¡ããšããŠãããŸã§äœããŸããã æ¬¡ã¯ãå®éã«ã«ãŒãã£ã³ã°ãMVCãªã©ãLaravelã®ã¡ã€ã³æ©èœã«ã€ããŠã玹ä»ããŠãããŸã Laravelã®MVCãšãã®ä»ã®æ©èœ ã«ãŒãã£ã³ã° ã³ã³ãããŒã©(C) ãã¥ãŒ(V) ã¢ãã«(M) ããã«ãŠã§ã¢ ãã°ã€ã³åŸã®ãªãã€ã¬ã¯ãå
å®è£
ããããŒãž Authã¯èªåã§å®è£
ãããã®ã§å²æããŠããŸãã TODOã¢ããªã±ãŒã·ã§ã³ã¯SPAã§äœæããAPIãå©ããŠæäœãè¡ããŸãã ã«ãŒãã£ã³ã° ããããåºç€ã宿ããã®ã§ãã«ãŒãã£ã³ã°ã®èª¬æã«å
¥ããŸãã Laravelã®ã«ãŒãã£ã³ã°ã¯ routes ãã£ã¬ã¯ããªå
ã«ååšããããããã®ãã¡ã€ã«ã¯çšéã«ãã£ãŠãã¬ãã£ãã¯ã¹ãåæã§ã€ããããŠãããããŸãã ä»å㯠web.php ãç·šéããŠãããŸãããã routes/web.php <?php Route::get('/todo', function () { return "ãã®ããŒãžã¯ã¢ããªã±ãŒã·ã§ã³ã®ããŒãžã§ã"; }); ãã®ã«ãŒãã£ã³ã°ã远å ãããšãç»åã®ããã«è¡šç€ºãããŸãã ä»åã¯SPAãªã®ã§ããŸã䜿ããŸããããSPAã§ã¯ãªãã¢ããªã±ãŒã·ã§ã³ãäœãå Žåã¯åºæ¬çã«ããã«èšè¿°ããŠãããŸãã ãŸãã api.php ã«äœæããããšã§èªåçã«/api/ã®ãã¬ãã£ãã¯ã¹ãä»ããŸããä»»æã®ãã¬ãã£ãã¯ã¹ã«å€æŽãããå Žå㯠app/Provider/RouteServiceProvider.php ã倿ŽããŸãããã ããŠããã®ãŸãŸã§ã¯ã¯ããŒãžã£ãã©ãã©ãèšãäžãã£ãŠè¡ã£ãŠããŸããŸãã®ã§ã次ã®å·¥çšã§ãã£ãããšåæ¥ããŠãããŸãã ã³ã³ãããŒã© web.php ãããžãã¯ã§ã©ãã©ãæ±æãããŠããã®ã§ãã³ã³ãããŒã©ãšåŒã°ãããã®ã§åæ¥ããŠãããŸãããã äžèšã®ã³ãã³ãã§ã³ã³ãããŒã©ãèªåçæãããŸãã $ php artisan make:controller TodoController Controller created successfully. TodoController.phpã®äžã«ã¡ãœãããçãããweb.phpããèªã¿èŸŒãã§ã¿ãŸãããã app/Http/Controllers/TodoController.php <?php namespace App\Http\Controllers; use Illuminate\Http\Request; class TodoController extends Controller { public function index() { return "ã³ã³ãããŒã©ããããã«ã¡ã¯"; } } routes/web.php <?php Route::get('/todo',TodoController::class . "@index"); å®è£
ãåºæ¥ãããphp artisan serveã§èŠãŠã¿ãŸãããã ãããã§ããããã ã³ã³ãããŒã©ã«åå²ããããšã«ãã£ãŠã«ãŒãã£ã³ã°ã«ããç»é¢ãæ©èœå¥ã«ããžãã¯ãèšè¿°ããããšãå¯èœã«ãªããŸããã ãã¥ãŒ ã§ã¯ããã¥ãŒã衚瀺ããŠã¿ãŸãããã Laravelã®ãã¥ãŒã¯åŒ·åãªbladeãã³ãã¬ãŒããšã³ãžã³ãå«ãã§ããŸãã ã³ã³ãããŒã©ãã倿°ãæž¡ããbladeãã³ãã¬ãŒããšã³ãžã³ã«ãã衚瀺ããŠã¿ãŸãã $ touch resources/views/todo.blade.php resources/views/todo.blade.php <?php @extends('layouts.app') @section('content') <div class="container" <div class="row justify-content-center" <h2TODO ã¢ããªã±ãŒã·ã§ã³</h2 </div </div @endsection @ããå§ãŸããã®ã¯bladeãã³ãã¬ãŒããšã³ãžã³ç¹æã®ã¡ãœããã§ãã ä»åã¯æ¢ã«çšæãããŠããã¬ã€ã¢ãŠããã¶ã€ã³ãå©çšããŸãã äžèšã®ãã¡ã€ã«äœæãçµããã°ãTodoController.phpã倿ŽããŠãããŸãã view()ã¡ãœããã«bladeãã³ãã¬ãŒãã®ãã¡ã€ã«åãèšå
¥ããã°viewãåž°ããŸãã app/Http/Controllers/TodoController.php <?php namespace App\Http\Controllers; use Illuminate\Http\Request; class TodoController extends Controller { public function index() { return view('todo'); } } ã¢ãã« Eloquent ORM ãšåŒã°ããéåžžã«ã·ã³ãã«ãã€é«æ©èœãªORMãLaravelã§ã¯æäŸãããŠããŸãã ããã§ããã¢ãã«ãšã¯Eloquentã¢ãã«ã®ããšã§ãããEloquent ORMã®å©ç¹ãæå€§éçãããããã®ã§ãã ãŸãã¯ããã«ãã¢ãã«ãäœæããŸãããã $ php artisan make:model Todo åºæ¬çã«ã¯ããã§çµããã§ãã ããŒãã«åã todos ã§ããã°ãã¢ãã«å㯠Todo ã¢ãã«åã Sample ã§ããã°ãããŒãã«å㯠samples ãã®æ¹åŒã§æ±ºå®ããŠããŸãã ä»®ã«ããŒãã«åãšã¢ãã«åï¿œï¿œï¿œå€æŽãããå Žåã¯ã¢ãã«ãã¡ã€ã«(app/ã¢ãã«å.php)ã®ã¯ã©ã¹å€æ°ã« <?php protected $table = 'ããŒãã«å'; ãšæå®ããããšãåºæ¥ãŸãã ã§ã¯ã確èªããŠã¿ãŸãããã Illuminate\Database\Eloquent\Collection {#2981 all: [ App\Todo {#2980 id: 2, todo: "TestTest", user_id: 1, created_at: null, updated_at: null, }, ], } insertæã§è¿œå ããŠã¿ãŸããã ãã£ãããšåæ ãããŠããŸããã ã¢ãã«ïŒãªã¬ãŒã·ã§ã³ã®å®çŸ©ïŒ ã¢ãã«ã«ãªã¬ãŒã·ã§ã³ãå®çŸ©ããããšãåºæ¥ãŸãã ããªã䟿å©ãªã®ã§æ¯é䜿ã£ãŠãããããšããã§ãã ä»åã®ãªã¬ãŒã·ã§ã³å
容ãå確èªããŠã¿ãŸãããã users.id ãš todos.user_id ãçŽä»ããŠããŸããã ããããŠãŒã¶åŽã®ã¢ãã«ããtodosãåç
§åºæ¥ãããã«ã¢ãã«ã«å®çŸ©ããŠãããŸãã app/User.php <?php class User extends Authenticatable { ... çç¥ public function todos(){ return $thishasMany('App\Todo'); } } ããã§å®è£
ãçµããã§ãã Tinkerã§ç¢ºèªããŠã¿ãŸãããã ãå©çšããããšã§ãŠãŒã¶ã«çŽä»ããTodosããŒãã«ã®ã¬ã³ãŒããåãåãããšãåºæ¥ãŸãã ããã«ãŠã§ã¢ ã«ãŒãã£ã³ã°ããéã«ãç¹å®ã®ããŒãžãã«äžå®ã®æäœãäžãããã ãªã©ã®ããŒãºã«å¿ããã®ãããã«ãŠã§ã¢ã§ãã çŸç¶åé¡ãšãªã£ãŠããã®ã¯ããã°ã€ã³ããŠããªããŠã/todoã«ã¢ã¯ã»ã¹åºæ¥ãŠããŸããšããããšã§ãã ãã°ã€ã³ããŠããªãã®ã«Todoç»é¢ãžé·ç§»ãããŠã¯ãšãŠãå°ããŸãããŠãŒã¶æ¯ã«æ
å ±ã衚瀺ããã®ã«ãã®ãŠãŒã¶ã誰ãããããªãã®ã§ãšã©ãŒãåºãŠããŸããŸãã ããšãã£ãŠãæ¯ããŒãžåãåäœãèšè¿°ããã®ã¯ãšãŠãã¹ããŒããšã¯èšããŸããã ããã§ãããã«ãŠã§ã¢ã®ç»å Žã§ãã 説æãããã£ãŠã¿ãã»ããæ©ãã®ã§ãã³ãŒããèšè¿°ããŸãã routes/web.php <?php Route::group(["middleware""auth"],function(){ Route::get('/todo',TodoController::class . "@index"); }); Route::groupã®ç¬¬2åŒæ°ã®ã¯ããŒãžã£ã«å
çšã® /todo ãå
¥ããŠã¿ãŸãããã ãããšã/todoã«ã¢ã¯ã»ã¹ããããšãããšãã°ã€ã³ç»é¢ãžãªãã€ã¬ã¯ãããŸããããã§ãã°ã€ã³å€å®ãåºæ¥ãã®ã§ãã¡ãã¡ã³ã³ãããŒã©å
éšã«ããžãã¯ãæžãããšã¯ãããŸããã ãŸããããã«ãŠã§ã¢ã¯èªäœããããšãåºæ¥ãŸããåŸã»ã©APIäœæã®éã«ã²ã€ããã«ãªããŸãã®ã§ãã¡ãã§è©³ãã解説ããããŸãã ãã°ã€ã³åŸã®ãªãã€ã¬ã¯ãå
çŸç¶ãæ°èŠç»é²ã»ãã°ã€ã³åŸã« /home ãžãªãã€ã¬ã¯ãããŠãããšæããŸãã ããã¯LoginController.php ãªã©ãèªåçã«ãªãã€ã¬ã¯ãåŠçãè¡ã£ãŠããããã§ãã ä»åã¯/homeãå©çšããŸããã®ã§ãåé€ããæ¹æ³ãèšèŒããŸãã app/Http/Controllers/Auth/LoginController.php app/Http/Controllers/Auth/RegisterController.php app/Http/Controllers/Auth/ResetPasswordController.php app/Http/Controllers/Auth/VerificationController.php - protected $redirectTo = '/home'; + protected $redirectTo = '/todo'; resources/views/home.blade.php åé€ routes/web.php name('home'); ããã§ãã°ã€ã³åŸã¯ /todo ãžãªãã€ã¬ã¯ãããŸãã TODOã¢ããªã±ãŒã·ã§ã³ã®ã¡ã€ã³æ©èœå®è£
ïŒãµãŒããŒãµã€ãå®è£
ïŒ APIã®å®è£
ãŸãã¯ããã«APIã®å®è£
ãè¡ããŸãã ä»åã®APIã§ã®èªèšŒã¯ãã»ãã·ã§ã³ã§è¡ããããšæããŸãã æ©èœäžèЧ TODOã¢ããªã±ãŒã·ã§ã³ãäœæããã«åœãã£ãŠãAPIã®æ©èœãæŽãåºããŸãã ãã¡ãã®æ©èœãäœæããŠããããšæããŸãã æ©èœå®è£
ãŸããã³ã³ãããŒã©ã«å®çŸ©ããŸãã app/Http/Controllers/TodoController.php <?php use App\Todo; use Illuminate\Support\Facades\Auth; class TodoController extends Controller { ... çç¥ public function get(){ // å
šä»¶è¡šç€º } public function post(){ // 1件远å } public function delete(){ // 1ä»¶åé€ } public function update(){ // 1ä»¶æŽæ° } } 次ã«ãã«ãŒã¿ãŒã«è¿œå ããŠãããŸããapi.phpã«ãªã£ãŠããã®ã§æ³šæããŠãã ããã route/api.php <?php Route::get('/todo','TodoController@get'); Route::post('/todo','TodoController@post'); Route::delete('/todo/{id}','TodoController@delete'); Route::put('/todo/{id}','TodoController@update'); 次ã¯ç¢ºèªãã¯ãã¿ã€ã€ãããããã®æ©èœãå®è£
ããŠãããŸãã å
šä»¶è¡šç€º <?php public function get(){ return response()json(Auth::user()todos()get()); } ã¢ãã«ã®èª¬æã®æã«è¡ã£ããã®ãšåãã§ãã 1件远å <?php public function post(Request $request){ $todo = new Todo(); $todotodo = $requesttodo; $todouser_id = Auth::id(); $todosave(); return response("OK", 200); } ã¢ãã«ã§ã€ã³ã¹ã¿ã³ã¹ãçæããããããã«å€ãåœãŠã¯ããŠããæåŸã«ã»ãŒããããã°SQLãçºè¡ããŠè¿œå åŠçãè¡ã£ãŠãããŸãã Todo::insert()ã§ãåãããšãè¡ãªããŸãã 1ä»¶åé€ <?php public function delete($id){ Todo::find($id)delete(); return response("OK", 200);; } Todoã®ã€ã³ã¹ã¿ã³ã¹ã«deleteã¡ãœããããããŸãã®ã§ããããå®è¡ããã°åé€ã§ããŸãã 1ä»¶æŽæ° <?php public function update(Request $request,$id){ $todo = Todo::find($id); $todotodo = $requesttodo; $todosave(); return response("OK", 200); } 远å ã®æãšã»ãŒåãã§ãfindã§todoã®ã€ã³ã¹ã¿ã³ã¹ãæã£ãŠããã ãã§åºæ¥äžãããŸãã APIã®Authå®è£
ãã®ãŸãŸã§ã¯èª°ã§ãAPIã«ã¢ã¯ã»ã¹ã§ããŠããŸããŸãã ãããã³ãŒãå
éšã§ Auth::ãå©çšããŠããã®ã§ããã°ã€ã³ããŠããªããŠãŒã¶ãã¢ã¯ã»ã¹ãããšãšã©ãŒãçºçããŸãã ããã§ã¯ãã®AuthïŒèªèšŒïŒãAPIããã§ãè¡ããããã«å€æŽã远èšããŠãããŸãã ã»ãã·ã§ã³ãæå¹å APIã§ã¯ããã©ã«ãã§AuthorizedTokenãå©çšãããããªèšèšã«ãªã£ãŠããŸãã ä»åã¯ã»ãã·ã§ã³ãå©çšããã®ã§ä»¥äžã®ããã«å€æŽããŸãã app/Http/Kernel.php <?php // çç¥ protected $middlewareGroups = [ 'web' [ \App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, // \Illuminate\Session\Middleware\AuthenticateSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, \App\Http\Middleware\VerifyCsrfToken::class, \Illuminate\Routing\Middleware\SubstituteBindings::class, ], 'api' [ // ããã远å \App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, \App\Http\Middleware\VerifyCsrfToken::class, \Illuminate\Routing\Middleware\SubstituteBindings::class, // ãããŸã§è¿œå 'throttle:60,1', 'bindings', ], ]; // çç¥ ããã§ã»ãã·ã§ã³ãæå¹ã«ãªããŸãã ããã«ãŠã§ã¢ã®äœæ ããã©ã«ãã§åãã£ãŠããAuthã®ããã«ãŠã§ã¢ã¯ãã¥ãŒã«æé©åãããŠããããã°ã€ã³ããã«ããã«ãŠã§ã¢ã«å°éãããš /login ã«ãªãã€ã¬ã¯ããããŠããŸããŸãã APIã§ã¯ãªãã€ã¬ã¯ãã§ã¯ãªã ãšã©ãŒã¡ãã»ãŒãž ãåž°ã£ãŠããããšãæåŸ
ããŸãã ã§ãã®ã§ããã«ãŠã§ã¢ãèªäœããŸãã $ php artisan make:middleware AuthApi app/Http/Middleware/AuthApi.php <?php use Illuminate\Support\Facades\Auth; // çç¥ public function handle($request, Closure $next) { if (!Auth::check()) return response("",401,["Content-type: application/json"]); return $next($request); } use ...Auth ã®è¡ãå¿
èŠã§ãã®ã§æ³šæããŠãã ããã app/Http/Kernel.php <?php // çç¥ protected $routeMiddleware = [ // çç¥ 'auth.api' \App\Http\Middleware\AuthApi::class, ]; ããã§ããã«ãŠã§ã¢ã®å®è£
å®äºã§ãã å®è£
å
çšäœæããtodoã®ã«ãŒã¿ãŒã«å€æŽãå ããŠãããŸãã route/api.php <?php Route::group(["middleware" "auth.api"],function(){ Route::get('/todo','TodoController@get'); Route::post('/todo','TodoController@post'); Route::delete('/todo/{id}','TodoController@delete'); Route::put('/todo/{id}','TodoController@update'); }); ããã§ãã°ã€ã³ããŠããªããš401ãšã©ãŒãè¿ãããšã«ãªããŸãã ããã³ãã®å®è£
ããããããã³ãã®å®è£
ã«å
¥ããŸãã ããã§ã¯Vue.jsãå©çšããSPAã§å¶äœããŠãããããšæããŸãã VueJSã®æ§ç¯ Laravelã¯ããã©ã«ãã§VueJSãå°å
¥ãããŠããŠã æ¢ã«Exampleãã¡ã€ã«ãæ§ç¯ãããŠããŸãã WebpackãäœãæžããªããŠãåæå°å
¥ãããŠããŸãã ãããã£ãŠãnpmã€ã³ã¹ããŒã«ãè¡ããViewãå°ã倿Žããã ãã§VueJSãå°å
¥ã§ããŸãã $ npm i $ npm run dev $ npm run watch # ãã¡ã€ã«ã®å€æŽæãèªåçã«ã³ã³ãã€ã«ãèµ°ã resources/views/todo.blade.php @extends('layouts.app') @section('content') <div class="container" <div class="row justify-content-center" <h2TODO ã¢ããªã±ãŒã·ã§ã³</h2 <example-component</example-component </div </div @endsection ã远å ããããšã§Vue.jsã®å°å
¥ã¯å®äºã§ãã APIãå©ããªã¯ãšã¹ãã¢ãžã¥ãŒã«ãäœæ APIãå©ãéãæ°ãå€ããªã£ãŠãããšãã¡ããã¡ãã«ãªã£ãŠããã®ã§ãAPIãå©ãæ©èœã¯å¥ã«äœæããŸãã resources/js/api.js "use strict" const send = (method,uri,data={} { const url = 'http://127.0.0.1:8000' + uri return new{ var xhr = new XMLHttpRequest(); xhr.open(method, url); xhr.setRequestHeader("Content-Type", "application/json; charset=utf-8" { try{ const res_json = JSON.parse(xhr.responseText) resolve(res_json) }catch (e) { resolve(xhr.responseText) } } { console.log(xhr.status); console.log("error!"); }; xhr.send(data); }) } const api = { getTodoList(){ return send("GET","/api/todo"); }, postTodo(todo){ return send("POST","/api/todo",todo); }, updateTodo(id,todo){ return send("PUT","/api/todo/" + id,todo); }, deleteTodo(id,data){ return send("DELETE","/api/todo/" + id,data); } } export default api APIãå©ãããã®ã¡ãœãã send ãçšæããŠãäžæ®µã«APIããªã¹ãã®ããã«èšè¿°ããããšã§æ°ãã«APIãå¢ããŠã远å ããããããã«ããŸãã ã³ã³ããŒãã³ãã®å®è£
ã§ã¯ãé§ãè¶³ã§ã³ã³ããŒãã³ããäœæããŠãããŸãããã ä»åã¯Laravelã®ç޹ä»ãªã®ã§ããã³ãå®è£
ã®éšåã¯å€§å¹
ã«ã«ããããŸãã 以äžã®ãœãŒã¹ã³ãŒãããŸãããšã³ããŒããã°åäœãããšæããŸãã resources/js/components/ExampleComponent.vue <template <div class="container" <div class="row justify-content-center" <div class="col-md-8" <div class="card" <div class="form-group" <input type="text" class="form-control" id="inputtodo" v-model="todo_form" <button type="button" class="btn btn-primary" @click="addTodo"Add</button </div </div <div class="card" v-for="todo in todos" <div class="card-header" <button type="button" class="btn btn-danger" @click="deleteTodo(todo.id)"Delete</button <button type="button" class="btn btn-info" @click="updateTodo(todo.id)"Update</button <input type="text" class="form-control" id="todo" v-model="todo.todo" </div </div </div </div </div </template <script import api from "../api.js" export default { data(){ return { active_todo: null, todo_form:"", todos:[] } }, methods:{ addTodo(){ let data = {todo:this.todo_form} data._token = document.getElementsByName('csrf-token')[0].content; api.postTodo(JSON.stringify(data)).then((){ this.getTodoList() }) }, deleteTodo(id){ let data = {} data._token = document.getElementsByName('csrf-token')[0].content; api.deleteTodo(id,JSON.stringify(data)).then((){ this.getTodoList() }) }, updateTodo(id){ let data = {todo:this.todos.filter((v){return v.id === id})[0].todo} data._token = document.getElementsByName('csrf-token')[0].content; api.updateTodo(id,JSON.stringify(data)).then((){ this.getTodoList() }) }, getTodoList(){ api.getTodoList().then((result){ this.todos = result }) } }, mounted() { this.getTodoList() console.log('Component mounted.') } } </script ããããã®æ©èœããšã« method ãçšæããŠãdataãv-modelãªã©ãé§äœ¿ããŠAPIãå©ããŸãã APIãå©ããåŸã¯ããããthis.getTodoListãè¡ã£ãŠããŸãããããã¯å€æŽãé©å¿ããããã§ãã 宿 TODOãªã¹ãã宿ããŸããã æåŸã« ãããã§ããã§ããããã èšäºãé·ããªã£ãŠããŸããŸããããå®éã«èšè¿°ãããœãŒã¹ã³ãŒãã¯ã»ãã®äžéšåã ãã§ãã ãã¡ãã«ã¢ããªã±ãŒã·ã§ã³ã®ãœãŒã¹ã³ãŒããèŒããŠãããŸãã GitHub - optim-corp/techblog-laravel-todo-sample AuthïŒèªèšŒïŒãAPIã®äœæãSPAã®å®è£
ãŸã§ãã®éã§åºæ¥ãŠããŸããŸãã ãã®èšäºã®éãã«å®è£
ãè¡ãã°äžèšã®Todoã¢ããªã±ãŒã·ã§ã³ãåºæ¥äžãããŸãããããªããŒã·ã§ã³ãã§ãã¯çã® ãšã©ãŒãã³ããªã³ã°ãå
šãè¡ã£ãŠãããŸããïŒç¹ã«APIéšåïŒ ã®ã§ããæ³šæãã ããã æåŸã«ãªããŸãããããLaravelã䜿ã£ãŠçéWebã¢ããªã±ãŒã·ã§ã³éçºãè¡ã£ãŠãããïŒããšããèšèãæ®ããŠç· ãããããããšæããŸãã ããããšãããããŸãããã OPTiMã§ã¯æ§ã
ãªåéã§æŽ»èºã§ãããšã³ãžãã¢ãåéããŠãããŸãã ä»åã®ãããªWebã¢ããªã±ãŒã·ã§ã³ãç¶ããæ©æ¢°åŠç¿ãã¯ã©ãŠãç³»ã€ã³ãã©åšããŸã§ããããåéã§æŽ»èºåºæ¥ãå ŽããããŸãïŒ èå³ãããæ¹ã¯æ¯éåŒç€Ÿæ¡çšããŒãžã«ãŠã芧ãã ããïŒ www.optim.co.jp ãŸããå€å£ã€ã³ã¿ãŒã³ã·ãããåéããŠãããŸãã®ã§ãåãããŠã芧ãã ããã www.optim.co.jp
0 notes
Text
ððððððð 6 ROLES and PERMISSIONS + ADMIN AREA - EASY LARAVEL TUTORIAL - Part 1 - Laravel
ððððððð 6 ROLES and PERMISSIONS + ADMIN AREA â EASY LARAVEL TUTORIAL â Part 1 â Laravel
ððððððð 6 ROLES and PERMISSIONS + ADMIN AREA â EASY LARAVEL TUTORIAL â Part 1 â Laravel
[ad_1]
Laravel 5.8 / Laravel 6 Roles & Permissions tutorial.
Create roles, permissions and an admin area in Laravel with this easy tutorial.
â Create Role models which define what name the role has
â Create middleware to protect certain routes from being accessed
â Add checks to controller methods to preventâŠ
View On WordPress
0 notes