NotionCommotion Posted November 23, 2016 Share Posted November 23, 2016 (edited) I've never used a 3rd party framework, and am thinking of trying one out. Any recommendations on which one to try first? What about Laravel? Playing with it, and my initial concern is that it seems a little mystic regarding configuration. Any recommended Laravel tutorials? I am using https://laravel.com/docs/5.1/quickstart, and the database won't connect. Looking at .env, I see the database credentials are not correct, and I suppose I set them here, but am concerned that this tutorial doesn't even address doing so. Edited November 23, 2016 by NotionCommotion Quote Link to comment Share on other sites More sharing options...
benanamen Posted November 23, 2016 Share Posted November 23, 2016 I just installed Laravel 5.3 (Current version) last night on Win7/Xammp. So far I am finding the official documentation much less than helpful. I had to go to a third party site just to figure out how to install it using composer. So far, the tutorials I have found even for version < 5.3 differ from the current release. Quote Link to comment Share on other sites More sharing options...
NotionCommotion Posted November 23, 2016 Author Share Posted November 23, 2016 https://laravel.com/docs/5.1/quickstart ships with 5.2.20. Note sure how much different it will be from 5.3.24. [Michael@devserver laravel]$ php artisan --version Laravel Framework version 5.3.24 [Michael@devserver laravel]$ cd .. [Michael@devserver www]$ cd qu* [Michael@devserver quickstart]$ php artisan --version Laravel Framework version 5.2.20 [Michael@devserver quickstart]$ Quote Link to comment Share on other sites More sharing options...
kicken Posted November 23, 2016 Share Posted November 23, 2016 I was not a fan of Laravel when I tried it, particularly with their facades thing. It made PHPStorm's helpful features about useless unless you installed some stub library to define all the facades. I found their Eloquent ORM system to be not as useful as Doctrine as well. I was comparing Laravel side-by-side with Symfony at the time. Symfony won for me fairly early on so I never did get real far into Laravel. This was also a couple years ago (Symfony 2.x vs Laravel 4.x) so the experience is probably not as relevant. I find with a lot of projects, particularly large ones, you generally have to be willing to dive into the code and figure things out rather than just rely solely on the documentation. Many times the documentation is missing some small details that you can find by digging into the code. That's one of the reasons I preferred symfony because it was easy to dig into the code by utilizing PHPStorms code navigation tools. Quote Link to comment Share on other sites More sharing options...
ignace Posted November 23, 2016 Share Posted November 23, 2016 (edited) @kicken I tried Laravel recently 5.3 and the same things that bugged you, still bug people. PHPStorm does not understand Laravel with all their facades. They claim they love beautiful code but then go on to do something like: https://laravel.com/docs/5.3/session#registering-the-driver Create an entire new class to simply call a static method on another? Is this something we want to promote? Their expressive interfaces are nice though. And it comes with a lot of functionality out of the box. Where you would need quite a few bundles in Symfony to have the same functionality. Edited November 23, 2016 by ignace Quote Link to comment Share on other sites More sharing options...
benanamen Posted November 23, 2016 Share Posted November 23, 2016 I just finished the following 5.3 CRUD tutorial. It gave me a quick idea of how to do basic database operations. There was only one small error which is now noted in the page comments. http://www.hc-kr.com/2016/10/laravel-5-crud-tutorial-ajax-bootstrap.html I don't have any framework experience to compare with, but I am liking the migrations feature to create the DB and track changes along with rolling back to a previous schema. I can see if you know how to use Laravel you could get something up and running pretty quickly. Quote Link to comment Share on other sites More sharing options...
NotionCommotion Posted November 24, 2016 Author Share Posted November 24, 2016 I just finished the following 5.3 CRUD tutorial. It gave me a quick idea of how to do basic database operations. There was only one small error which is now noted in the page comments. http://www.hc-kr.com/2016/10/laravel-5-crud-tutorial-ajax-bootstrap.html I don't have any framework experience to compare with, but I am liking the migrations feature to create the DB and track changes along with rolling back to a previous schema. I can see if you know how to use Laravel you could get something up and running pretty quickly. Hi Benanamen, Did you get the following error? "NetworkError: 404 Not Found - http://laravel.example.com/css/font-awesome.min.css" Quote Link to comment Share on other sites More sharing options...
benanamen Posted November 24, 2016 Share Posted November 24, 2016 (edited) Yes. font-awesome.min.css is not part of bootstrap or Laravel. Either download it or use a CDN. I updated my comment on that tutorial page. CDN https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css I got down on Laravel Authorization yesterday. Super easy to do. Laravel does all the work. Here is the tutorial I used. It is just a couple commands. http://www.hc-kr.com/2016/09/laravel-5-authentication-login-registration-form.html Moving on to Form to Email today. Edited November 24, 2016 by benanamen Quote Link to comment Share on other sites More sharing options...
NotionCommotion Posted November 24, 2016 Author Share Posted November 24, 2016 Have fun on emails! Can you explain the following lines of code to me? Route::group(['middleware' => ['web']], function() { Route::resource('blog','BlogController'); }); Quote Link to comment Share on other sites More sharing options...
benanamen Posted November 24, 2016 Share Posted November 24, 2016 Route groups allow you to share route attributes, such as middleware or namespaces, across a large number of routes without needing to define those attributes on each individual route. Shared attributes are specified in an array format as the first parameter to the Route::group method. You can read about middleware here https://laravel.com/docs/5.3/middleware As far as when I was doing the Auth, sending emails either locally or through Gmail was very, very simple. Quote Link to comment Share on other sites More sharing options...
NotionCommotion Posted November 26, 2016 Author Share Posted November 26, 2016 Thanks again benanamen, Still a little confused. Per https://laravel.com/docs/5.3/routing, I see two routes both which utilize the auth middleware. Route::group(['middleware' => 'auth'], function () { Route::get('/', function () { // Uses Auth Middleware }); Route::get('user/profile', function () { // Uses Auth Middleware }); }); I would like to compare this against the following. Route::group(['middleware' => ['web']], function() { Route::resource('blog','BlogController'); }); Because, middleware is set to an array ['web'] and not a string, all the following middleware is added to the route? What if I also wanted the 'auth' middleware? 'web' => [ \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, ] And then I don't see individual routes, but understand that Route::resource() https://laravel.com/docs/5.3/controllers#resource-controllers makes 7 routes to the seven methods (index, create, store, show, edit, update,destroy) in BlogController for the particular http method. Do I understand this correctly? Quote Link to comment Share on other sites More sharing options...
benanamen Posted November 26, 2016 Share Posted November 26, 2016 Auth is really simple. There are only a few steps. Do this quick tutorial on Auth and see if it answers your questions. I am still learning this. http://www.hc-kr.com/2016/09/laravel-5-authentication-login-registration-form.html The Laracasts are really good, but were for a bit older version so some things are slightly different such as routes.php not existing in the current version. (Now routes/web.php). I suggest you just go through these videos step by step and then see if you are left with any questions at the end. https://laracasts.com/series/laravel-5-from-scratch Quote Link to comment Share on other sites More sharing options...
NotionCommotion Posted November 27, 2016 Author Share Posted November 27, 2016 Turns out Route::group(['middleware' => ['web']], function() {}) and Route::group(['middleware' => web'], function() {}) are the same, and if more than one middleware are desired, one should use an array and pass both. I expect that $middlewareGroups and $routeMiddleware are both searched and added as applicable. Yea, Laravel does all the work and authorization is easy, however, it still seems a little magical to me. I found it helpful to git the directory so I can see what files Laravel is changing when I do things such as php artisan make:auth. Quote Link to comment Share on other sites More sharing options...
benanamen Posted November 27, 2016 Share Posted November 27, 2016 (edited) Yea, Laravel does all the work and authorization is easy, however, it still seems a little magical to me. I found it helpful to git the directory so I can see what files Laravel is changing when I do things such as php artisan make:auth For sure! I was thinking, "Is this all there is to Authentication?". I also am going to git for exactly the same reason. The more I study Laravel, the more I am liking it. Edited November 27, 2016 by benanamen Quote Link to comment Share on other sites More sharing options...
NotionCommotion Posted November 27, 2016 Author Share Posted November 27, 2016 Hi benanamen, Have you had any success with setting up node.js per How to Manage Your CSS and JS ? Doesn't work for me, and npm install results in the following error: npm ERR! Error: No compatible version found: webpack@'>=2.1.0-beta.15 <=2.1.0--beta.22' Quote Link to comment Share on other sites More sharing options...
benanamen Posted November 27, 2016 Share Posted November 27, 2016 I have not got there yet. Keep in mind, those Laracasts are for an older version of Laravel. Quote Link to comment Share on other sites More sharing options...
benanamen Posted November 27, 2016 Share Posted November 27, 2016 In the currrent version of Laravel Blade has changed a bit from what the tutorial on Layout Files shows at https://laracasts.com/series/laravel-5-from-scratch/episodes/5?autoplay=true Take note of @show in the current version. Took me awhile to figure out there was changes from the video. Video instructions work, but again, not the current way of Blade Templating. Just reference the 5.3 docs here https://laravel.com/docs/5.3/blade Quote Link to comment Share on other sites More sharing options...
benanamen Posted November 27, 2016 Share Posted November 27, 2016 Hi benanamen, Have you had any success with setting up node.js per How to Manage Your CSS and JS ? Doesn't work for me, and npm install results in the following error: npm ERR! Error: No compatible version found: webpack@'>=2.1.0-beta.15 <=2.1.0--beta.22' I just finished this video. I did not have this problem. Did you find out why you did? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.