Honestly, it seems to me like
1. you were expecting tailwind to be just like bootstrap. that is not the case and never will be.
2. the point of tailwind is to give you the freedom to style your own components with predefined values so your ui doesn't become a mess.
3. You're not used to components, if you're having to repeat yourself too many times.
4. https://tailwindcss.com/docs/pseudo-class-variants was literally the first result when I looked up hover
.
5. Tailwind bundle size is much smaller than bootstrap's, even without PurgeCSS.
6. You're complaining abouy something that someone has done for free. If you're not satisfied, there's nothing stopping you from making a bootstrap version of jetstream (it might even exist already, knowing the laravel community).
I dont know, man, maybe you just don't like changes and learning new things... which is fine too, but you can't complain of people who do enjoy those when they bring improvements.
Chrome and Firefox both have the ability to throttle network requests to simulate various levels of slow internet.
Chrome: https://css-tricks.com/throttling-the-network/
Firefox: https://developer.mozilla.org/en-US/docs/Tools/Network_Monitor/Throttling
Laracasts.com has two free courses that would be beneficial to you:
1 is PHP for beginners. Now before you get insulted, it's not because I think you're a beginner but because it might help you fill in the gaps in your knowledge. It'll take you through everything including intro to OOP, MVC pattern, composer/autoloading, etc.
https://laracasts.com/series/php-for-beginners
2 is the follow up course here which is Laravel 8 from scratch. This will walk you through a pretty broad overview of laravel and how it can help you solve problems with laravel. By the time you through maybe a third of this tutorial, you should have a pretty good grasp on whether or not laravel is right for you.
Have fun with Laravel ! Community is big and they are a few resources out there to start !
Checkout https://laracasts.com/ Jeffrey is a very good teacher to set the basis
That is probably https://laracasts.com/.
Besides that, there are some great projects on Github, which you might look into.
And this is a great resource for information regarding Laravel in general: https://github.com/chiraggude/awesome-laravel
This is almost a direct copy of Laracasts "Incremental APIs" series. It even uses 100% same code in the first half of the tutorial.
I am okay if you learned it that way by watching that exact tutorial and want to give back to the community now but at least give some credit to the original author if you are copying him.
If you're new to JavaScript frameworks like React/Angular/etc. you might want to consider http://vuejs.org/. Quite easy to learn and https://laracasts.com/ has some good examples of using it with Laravel.
Otherwise, grab something you like. I don't think either php framework really dictates the choice for a Javascript framework.
i'm using this as the fundamental resource
https://laracasts.com/series/laravel-from-scratch-2017
try to code along, not just watching Jeffrey explanation while coding
JSON:API calls it "Inclusion of related resources".
Stripe's API supports what they call "expanding objects", where you can pass '?expand=computer' and instead of {"computer": 1234}
you will get back {"computer": {"id": 1234, "name": "..." } }
.
I tend to call it "including" if it's adding the object to the response and "expanding" if it's replacing an ID.
Laracasts is going to be the most widely recommended site to learn Laravel from. Jeffrey's series on Laravel 5.4 From Scratch is free and is what I would recommend starting off with. Even though the latest version of Laravel is 5.6, this series is still incredibly relevant and everything that he teaches in it can be used in the latest version of Laravel.
You put the development files in /resources/assets/
, and then your build process puts them in public/css
.
That way, you can use uncompressed, commented, easy to read Stylus/Sass files in development, then convert them to compressed, minified files in production.
Use Elixir to do that, there's a video here: https://laracasts.com/series/laravel-5-from-scratch/episodes/6
Honestly, that example looks horrible. It uses Laravel but the author has no clue what he is doing.
Your easiest solution would be to use a provider like Auth0: https://auth0.com/authenticate/laravel/azure-active-directory/
If you do the manual approach, you’ll have to lookup the documentation on Azures site and do it manual. I wouldn’t copy that code from the repo your shared.
Give your route a name with 'as'.
Then when you want to redirect use
redirect()->route('your_route_name');
Edit: Docs for the named routes: http://laravel.com/docs/5.1/routing#named-routes
http://laravel.com/docs/master/releases
I use PHP Storm. They just added blade support, which should make it even better.
http://blog.jetbrains.com/phpstorm/2014/08/phpstorm-8-eap-138-1505/
Jeffrey Way did some great videos w/ tips tricks here: https://laracasts.com/series/how-to-be-awesome-in-phpstorm
Take a look at array_filter. What you would do is query against the cards table once and then run the results through various filters to pull out the sub-sets that you want.
To be honest, I think there is some fundamental things that you need to understand about how a modern framework abstracts the idea of including different scripts based on a URL. I highly suggest you take a look at the free tutorial series on how to use Laravel, over at laracasts. https://laracasts.com/series/laravel-5-fundamentals
If you're serious about sticking with Laravel, I highly recommend Laracasts. Also, check out the IRC. Plenty of people there willing to help you out. Hell, I mostly just lurk on the IRC and I've picked up a few things off just that.
Lastly, if it makes you feel any better, the first blog project I tried to make took me months to make and it was still a piece of shit. And that's not counting the full month of multiple massive failures at trying to roll LAMP stacks manually, through Vagrant and PHPuppet, and finally through Vagrant and some passable bash scripts which I still need to work on again soon.
Just keep at it. Pain today, laughter tomorrow.
Digital ocean? $5 a month cheap enough or need cheaper? You could run a really small few projects on the $5 if needed too. Just be sure to setup swap https://www.digitalocean.com/community/tutorials/how-to-add-swap-on-centos-7
Ask yourself where the anxiety comes from.
For #1 - take a logical approach to it, which is natural for a backend engineer like yourself. I suspect you don't like the visual design aspect, since it's not seen as founded in logic (instead creativity). Great news though! It really is a logical approach. Find inspiration, put things that inspire you in a bookmark folder, and create something unique from all the good things you like from each. Dribbble.com is great for this, so is The Noun Project. Art in the past few centuries is really building on top of what others have done and adding something to it.
For #2 - If you dislike design work enough, consider finding someone to partner with. Otherwise try to find a way to efficiently get through the design process. Stimulants like Adderall or caffeine are great for doing things you can't focus on. Drugs all suck in their own way, so also consider looking up focus techniques and try hard to practice them. Make sure you are recording what is working and what isn't in your own personal feedback cycle.
Happy holidays my friend!
I like to use Vultr : https://www.vultr.com/
I also use moss.sh to deploy the server and configure it to work with laravel. You can even specify a github repo and have all pushes to the master branch automatically apply on the server. https://moss.sh/
https://laracasts.com/series/laravel-5-fundamentals
just to say that laracasts is an excellent resource. SOOO much stuff on there, and its all pushing you towards good SOLID practices.
Its changed my opinion on coding drastically for the better.
Worth the subscription. And the front-end stuff he is doing at the moment is great.
I really think you do not yet understand the basic of Laravel routing / view handling...
You might first want to try out some basic tutorials about creating routes and views.
Also if you are really serious about learning Laravel you could subscribe to https://laracasts.com to get some really good tutorial vids.
On windows there is also Laragon. Its great and reaaally simple. Just an installer, and an EXE to start the nginx, mysql, redis, node, and it comes with git, composer, and a bash-like-terminal, and auto-update your hosts file when you add a new project. Also you can change your php or mysql version with a couple of clicks. In my work PC (windows) I use vagrant since forever, but in my home pc just installed laragon and it is great for what I used it.
Cypress is so nice to work with. Laracast has a nice starter for Cypress with Laravel specific helpers like database seeders, csrf, login etc.
Laracasts, as always, are a great place to start. https://laracasts.com/series/build-a-laravel-app-with-tdd
Couple that with the Testing section of the Laravel docs, as well as information surrounding Laravel Dusk (which allows for actual browser-based testing, not just API testing), and you'll have all the tools you need to wrap your project(s) with decent tests.
Beyond that, you just have to intuit what's needed, where, etc.
I would suggest you give OctoberCMS a look. It's built on top of Laravel, and it's easy to tap into the underlying framework wherever you need(just clone/inspect the repo and you'll see a very familiar directory structure). I just built an expense management system for a large trade group within it and I would definitely choose it again. The backend is very polished and user-friendly.
I have to agree with what others have said about building your own CMS from scratch in principle, but I don't know your budget/time constraints/team size/familiarity with laravel/php in general so I can't say definitively that it would be a bad move. But I think there are some strong arguments against going that route even if your client does have deep pockets and a forgiving temperament.
For example, keep in mind that the bigger, established CMSs have already solved all of the nitty-gritty frustrating wrinkles you're going to run into with large scale content management. Another consideration is that if you're going to have to maintain this thing in the future you may inadvertently build yourself into a corner such that implementing some feature the client wants is a huge pain. To that effect, October has a very robust plugin system that you can use to your advantage there(I'm sure other CMSs are the same). Getting wordpress plugins to play nicely with Laravel(without committing heresy and modifying third-party code) might be a huge headache. So, just some considerations to take into account.
Do you have basic knowledge of OOP programing? Do you have any experience in MVC frameworks?
Myself personally never really liked Lynda for development training. If you are wanting to do Laravel I would suggest learning 5, as 5.1 will be similar and have an LTS Release soon.
https://laracasts.com/series/laravel-5-fundamentals
Is FREE for everyone I would say watch that and if you enjoy it subscribe to Laracasts and watch all the other great videos!
I don't see any of the problems you do. We currently use it in a very large app, as our main dashboard.
Tools, Resource Tools, Actions, and Custom Buttons are all possible. I am running multiple packages that extend Nova, from the Nova Packages website.
You complain about buttons, I can put buttons and links on the left navigation, but I can also put them right on top of any resource. This is done with nova's "custom-detail-toolbar". Here is a tutorial on how to do it: https://dev.to/jake/laravel-nova-adding-custom-buttons-to-resource-toolbars-1ob5
Our database currently has just over 280 million records in it, Nova is handling it fine.
If you want something that can actually be useful, learn elasticsearch. It opens up many opportunities to learn about your data because it can perform powerful aggregations that are much harder to do in plain SQL.
It's possible, but much more difficult than you'd imagine at first blush, mainly due to the legal questions involved with collecting money that is later distributed, which has differing legal requirements by State let alone by Country. You'd be better off starting with a Lawyer than here.
That said, Stripe has attempted to make it a bit easier to navigate with their Connect system... So I suppose you could take a look at that, though know that the only Laravel specific implementation was abandoned, so you would be building out the services yourself.
Why not use an accounting product off the shelf? Or even a hotel specific piece of software?
I always consider if there is an off the shelf product that will meet the customers needs before doing custom development (despite the majority of my work being custom development!)
Zero-downtime usually refers to deployments without schema changes. You can technically achieve a zero-downtime schema change by deploying the migration before the code, but this only works if you're not renaming or dropping a column. You'd commit your migration to a separate branch than your code changes, merge the migration branch and deploy, then merge the code branch and deploy.
EDIT: just as I finished writing this comment, Stripe posted how they do migrations. Not technically about zero-downtime, but a good read about dealing with migrations in a large scale.
Laracasts has an entire series on stripe payments. Check it out if you have not already.
Laravel is a great framework to start with for beginners as it really makes some of the more complex nuances of development easier to get a hang of while providing you with best practices to work with.
I would suggest starting with https://laracasts.com/series/laravel-5-fundamentals and looking at building something small with it. The series is free on Laracasts so theirs no reason not to give it a try.
Im in the process of redoing my businesses marketing website in Laravel from WordPress. We use WordPress largely for client work but Im beginning to feel the additional flexibility of Laravel would be a good addition to the tool set.
This will work, but it's pretty limited, most searches now use a least a fulltext-search, to match words in different order, words that are close etc...
The best it so use something like elastic search.
Laravel comes with a handy Log
class that you can call from anywhere:
\Log::info('Interesting information about my app'); \Log::warning('Potentially dangerous thing happened');
There are actually 8 log levels defined: http://laravel.com/docs/master/errors#logging
You can also pass an optional array of contextual data:
\Log::debug('The user logged in', ['user' => $user]);
You can use tail -F
to watch the log file as your application executes.
If you want to be able to step through your code and manipulate variables during runtime, I highly recommend checking out xdebug.
It seems like a lot of features aren't outright depreciated, but are hidden from documentation to discourage people from using them. Like with what happened with HTML / form builders, which disappeared from the documentation ~4.2. You have to do some serious digging to rediscover their existence.
In my opinion, it seems like Facades are dropping out of favor due to the framework leveraging namespaces a lot more. But I haven't seen anything official either way.
I wish they would either explicitly depreciate something or keep supporting it in documentation. Passive-aggressively removing something from documentation without any notice of deprecation and generating ambiguity of support around a feature is pretty annoying.
So, I think the problem here is related to eager loading vs. lazy loading.
Lazy loading is when you don't define a "with" clause and just load the relationship dynamically, if you're looping through these then every time you query the relationship you're going to be executing another query on the database. Eager loading is when you use a "with" clause, and it produces that big query you see at the end of your query screenshot. It does two queries total, it selects the records from the main table and then a second query to select any related records from the related table and then assigns them to the correct main table records in PHP. This is much, much faster than using lazy loading when it's being called more than once or twice.
I'd suggest reading through that doc and applying eager loading to all your queries.
Check out view composers. Something like
View::composers(array( 'UserComposer' => 'layouts.master', ));
class UserComposer {
public function compose($view) { $user = null; $user_id = Auth::id(); if (!empty($user_id)) { $user = User::find($user_id); } $view->with('user', $user); // logic for points..etc } }
Ah, here it is. You're outside basic Laravel convention here and you're going to end up fighting the framework. You need to be referencing Laravel routes defined in your routes.php, not specific files, from your jQuery.
So your $.post should be to something like '/users/find' or however you want to define it in your routes.php.
Take a look at Jekyll, a static site generator which you can use with GitHub Pages. You've probably got no need for something as complicated as Laravel, all you should need to know is HTML, Git basics and how Jekyll works.
That said it all depends how non-static it is. What do you intend to do with storing contacts?
If you're not comfortable with code at all, take a look at Wordpress/Squarespace, it can probably do what you want without having to roll your own CMS
Good question. Check out the stackoverflow link I've sent you including the comments there from other answers. Some user recommends Session::setId(Crypt::decrypt($_GET['id']));
, therefore using Crypt
to encrypt/decript the session id.
Maybe you can build a system of public and private key combination to assure that the session id won't be abused.
Also this is a good read regarding security issues: https://www.freecodecamp.org/news/protect-your-laravel-app-against-the-owasp-top-10-security-risks/
As a new Laraveler myself it is very confusing change. the paradigm is completely different to what I was expecting. however it is a well thought out framework.
As I am new I cannot give you many pointers except where I failed to pay attention while learning myself.
Firstly go here to laracasts and watch this video it was HUGELY informative I mean without it I would have floundered badly.
https://laracasts.com/series/laravel-6-from-scratch
[edit]The video is two versions old now as laravel moves quickly however its a great way to learn the basics and is current enough to get you on the right track.
Then look into webpack and mix.js its mentioned in the video above but not enough to pique your attention as you are still trying to learn the basics.
And have fun. its a great framework to learn.
I've used Forge in the past but 20$ a month is way too expensive. At the moment I'm using https://runcloud.io since it has the same features for 10$ a month. The only thing I needed to do was to create a .env file.
At the moment I'm working on my own server management tool because I think it's more secure to store ssh keys on a European server. It will take a while for me to finish it.
Have you looked into Forge? Just started using it (with AWS) recently after self-hosting (own hardware) for years. I am really enjoying the conveniences it brings. It’s not for everyone / everything but worth a look for sure. Good luck!
Check out creating your own custom Laravel presets. They will do sheet you need.
Edit: Here's some resources on how to do it
https://laracasts.com/series/how-to-create-custom-presets
https://austencam.com/pages/creating-a-custom-laravel-preset.html
You can do this with Events and Observers. When an event is being called (ex User liked their post) you can send a notification. I learned this here. There is also a great documentation on this available at the Laravel website.
You can definitely learn both at the same time, especially since you already have programming experience. One issue you might run into is having trouble differentiating what is a Laravel feature and what is a PHP feature. I've worked with people in the past who learned PHP with one framework and struggle to work on PHP projects that aren't written in that specific framework.
Like the other commenter mentioned Laracasts is a great resource, especially if you like learning from videos. The PHP Practitioner series would be a great place to start. The first few episodes might be too easy since they cover general programming concepts, but you can watch at 2x speed, or just skip the obvious ones.
Laravel 5.3 is just out. I wouldn't expect a vue tutorial for that specifically for a while. The laracasts are super handy. (I know you mentioned them).
Honestly your best bet is to get the basics from these lessons and then challenge yourself with some example you want to build.
This is indeed a pretty big indication that your user model is getting too many responsibilities. There is no real way to define a relation from the outside though; Laravel uses the magic __get() overflow method to check if the unknown property you tried to access exists as a relation method. This is how it is able to know that when you call:
dd($user->logs);
That it should check if there is a function called logs that returns a relation. This means that no matter what, the logs function will have to be available on your user model, otherwise the relation attribute won't work.
What you'll want to do instead is split the responsibilities over a couple of traits. You can see an example of it in Laravel itself, if you check the base controller provided in app/Http/Controllers/Controller.php. The base controller has no actual code; it simply uses the DispatchesCommands and ValidatesRequests traits. All functionality is contained within those two traits. It's no longer the responsibility of the base controller, but the base controller still contains the functionality by using the traits.
I'd suggest having a look at the Laracasts series for Solid design principles in PHP, it's quite an abstract level of OOP, so it might be rather difficult to grasp, but once you get the hang of it you'll end up with cleaner code, and less to no bloat in your models. If Laracasts isn't your thing, you can just google for SOLID principles in PHP, you'll probably find some tutorials / guides on it as well.
https://laracasts.com/series/laravel-5-fundamentals
These videos are free and walk you through getting started with Laravel 5. Laracasts (run by Jeffrey Way) is pretty much the ultimate source for Laravel and PHP. If you decide to continue learning PHP and Laravel, I suggest you subscribe. Well worth it IMHO.
You may be using an unsupported browser: http://caniuse.com/#search=FormData
"it causes an exception" - please post the exception, it may or may not be screaming exactly what the problem is.
If using Form::open then make sure you add a files option to your array:
echo Form::open(array('url' => 'foo/bar', 'files' => true))
Do you have SSH access? If you don't, follow this article
If you do, follow this one
https://github.com/petehouston/laravel-deploy-on-shared-hosting/blob/master/README.md
Define API. Do you want to create a REST API that provides CRUD capabilities on your application?
If that's the case, the most straightforward approach is to write additional routes and controllers to provide the API endpoints you need. Some advice pertaining to that:
Wrap your route definitions in a group so you can prefix both the URL and the controller namespace. Example:
// API Route::group(['prefix' => 'api', 'namespace' => 'API'], function() { Route::resource('team', 'TeamController'); });
Use existing authentication along with HTTP basic auth as a simple auth mechanism for your API (see example middleware in one of my projects: https://github.com/Riari/laravel-forum/blob/l5-refactor/src/Http/Middleware/BasicAuth.php)
For the most part, you can write your controller methods just like you normally would, only without returning views or redirect responses. A REST API should only ever return a formatted response with an appropriate HTTP status code - JSON being the most popular format to use. In fact, returning a model or collection directly from a controller will result in it being automatically cast to JSON, so that makes life easier for you if you want to take that shortcut.
Beyond that, you'll need to be a lot more specific about what you want to do :) but hopefully this helps you a little.
Take a look at View Composers. You can bind your data with the composer making it available in all the views, and you can specify which views/controller views to make it available for.
Good luck!
You need to use whereHas()
for relations, not where()
.
http://laravel.com/docs/5.0/eloquent#querying-relations
For example, your query would become:
Task::whereHas('users', function($q) use ($userId) { $q->where('id', $userId); // this 'where' is attached to the users relation scope
})->where('project_id', $id)->get(); // this 'where' is attached to the task scope
Alternatively, if you your task table has a user_id
column, then you could just do this:
Task::where(['project_id' => $id, 'user_id' => $userId])->get();
But that will only work if you do in fact have a 'user_id' column in your tasks table. If you have a many to many relationship with tasks and users, then you'll need to do what I recommended above.
It maps a request to a method. A GET request to /auth/something would look on the AuthController for a method called getSomething(), if a POST is made to /auth/something then it'll look for a method called postSomething(). So /auth/register as a POST request would find . IMO it's a terrible way of doing things, because you don't know what methods actually exist, without having to dig into the controller.
I know you said you don't want docs, but the docs do explain this - http://laravel.com/docs/5.0/controllers#implicit-controllers
Maybe you can take a look at Laracast they call it the netflix for developers...
I found this video for you https://laracasts.com/series/laravel-5-fundamentals/episodes/15 And you can take a look at: http://laravel.com/docs/5.0/authentication
Good luck with it.
Authentication is quite extensively covered in the L5 docs.
As for your implementation, you could just edit the users table / migration to include the is_super, is_admin, is_contractor and is_client booleans. After doing so, you can access the autheticated user's properties like Auth::user()->is_admin etc.
Or.. you could look into user roles and use a package like ENTRUST.
You forgot the most important part, why are you turning it into an array in the first place? Why aren't you sorting the collection or the query?
Have you gone through the collections documentation? http://laravel.com/docs/4.2/eloquent#collections
One of my favorite, and somewhat underutilized features of Laravel are its View Composers. Assuming you are using 'languages' and 'categories' for dropdown lists, or the like, you can use a view composer to attach any required data for you.
For example: create a view file called languages.blade.php. In it include the code for a dropdown list, much like you would have in 'books.create'. Then you bind a view composer to the languages.blade.php view file like so:
View::composer('languages', function($view) { $view->with('languages', Language::lists('language', 'id');); });
This means anytime you include the languages.blade.php partial view, the languages data will be automatically bound. So in your original 'books.create' view, add '@include('languages')' and you will have your dropdown list with your bound data inside it.
Jeffrey Way over at Laracasts has an excellent video on using View Composers if you want to learn more.
Expanding on the protection of sensative data there is now actually a built in way to do that. It is explained in the config docs. Makes it pretty easy overall.
Changing pricing plans frequently is quite common in SaaS products [1]. It gives the business a way to collect more data on how people react to the price of your product, giving you the opportunity to price it correctly.
If you only change your pricing once or twice a year, you get 1 or 2 chunks of data. As long as Forge isn't just continuously increasing price and is in fact trying to gauge the perceived value of the product, I don't see the problem.
We want to get value for money, they want to get money for value.
[1] - https://frontapp.com/blog/2017/02/13/how-we-de-risked-our-saas-pricing-strategy/
To change the port used, modify the listen line to the port you want the server to listen on.
Then you need to create different Server Blocks. In Apache they're called Virtual Hosts I think. Here's an easy to follow guide on how to do what you want to host multiple sites on one server.
I’m a huge fan of DigitalOcean for hosting web apps. I’ve been using them for well over a year now for various kinds of apps (Laravel and others) and their price-performance ratio is top notch.
Don’t know whether referral links are frowned upon here (please let me know if they are) but if you want $10 worth of free DigitalOcean credit to try it out then you can use this link to sign up. That’s a month or two of hosting, depending on the size of the droplet!
Take a look at Laracasts. They give a great introduction to those core concepts and how they should be used.
Keep in mind, it's not very common for a dev (especially entry-level) to know everything that ships with Laravel. In reality, most of the things that exist in Laravel are there because they make something easier or better in some way. Eloquent simplifies relational databases, Collections simplify array manipulation, etc. A lot of the things you'll only learn about because you really needed to. You'll ask yourself, "is there an easier way to do ____," and virtually always the answer is yes.
Take Events and Listeners for example. Say you build this wonderful app, but your alpha testers tell you that they wish they had notifications when things happen inside the app. They give you a list of all the actions they want to be notified about- so you go in to each of the controllers and add the notification generation.
Then you realize, the notifications don't have labels and there's nothing differentiating the read from the unread.
After you make your migration to update the schema, you've now got a dozen or more Controllers to sift through to update how those Notifications are generated. What if you forget one? Why are you doing Notification generation in so many places? Argh!
Had you written an Event to fire for each of those actions, you could put all of your Notification generation methods in a single Subscriber class that is cleanly separated from the actions that generate them. All of the Notification-generating code is in a single place, easy for updates and maintenance. Your functionality grows while your controller methods stay lean and clean.
If you'd like any additional advice or want me to review anything you've worked on, feel free to PM me. We can exchange discords if you'd like.
You don't really ever use $_GET with laravel, you'd use the Request
object. So as you are very new I recommend you checkout the free courses over at laracasts first to get a bit more of a grasp on how things work, I suggest starting with something like: Laravel 8 from scratch.
To be fair, if that is your first week, I'd suggest you visit laracasts.com and finish some of their courses there :) They will explain everything and give you examples :)
​
As for now... Well, since it's database related - entries in the database has to be related via a foreign key. This way, you'll have access to the application if it's mapped correctly
Use wkhtmltopdf. I believe it is what PDFCrowd uses on their end. It basically uses an embedded, headless Chromium browser to create a Print Preview of a page and then saves that preview as a PDF.
It's a command line util and I've never come across a Laravel package for it. mikehaertl/phpwkhtmltopdf
is a decent wrapper for it, though. I've done it that way and by calling the application directly using exec
. They both work fine.
You will need root access to whatever server this is going on, however. wkhtmltopdf requires libxrender
, which I don't believe is installed by default on most Linux distros, at least not Debian or CentOS which I've used it on.
http://wkhtmltopdf.org/
https://github.com/mikehaertl/phpwkhtmltopdf
A couple of points:
> Server Security > > Subscriber is solely responsible for maintaining the security of Subscriber's servers that are created via the Laravel Forge service. Laravel Forge shall have no liability for any security breaches or data breaches of Subscriber's servers, even if those servers were initially created and provisioned by Laravel Forge. Laravel Forge does not gurantee the security of any of Subscriber's servers, even if those servers were initially created and provisioned by Laravel Forge.
If you need higher levels of assurance that your server is secure, you will probably need to provision and deploy your environment itself and bring further control of the systems into your sphere of responsibility.
This example you've given isn't too bad as far as efficiency goes, but the strategies you're using are likely to result in the "n+1" problem.
If you have an laracasts account (which I hope you do if you're trying to become a better Laravel developer), you should watch this lesson:
Have you considered Elasticsearch? I currently use a combo of Elasticsearch and Vuejs for search-as-you-type functionality. With Elasticsearch's javascript client I am getting a response time of 8ms on my local machine running homestead.
Regardless of what you use, add a click event listener the the drop down list you are rendering with Vue. Bind the data to your input so when the user clicks the list, the input is updated to reflect what the user clicked.
<input v-model="searchquery" @keyup=startSearch name="query" > <div v-for="result in results"> <button class="autofillbtn" v-html="result.category_name" v-on:click.prevent="selectAndClear(result.category_name)" ></button> </div>
and the Vue instance
new Vue( { el: '#app', data: { searchquery: '', results: [] }, methods: { startSearch: function() { // search logic for elasticsearch, algolia, etc. here
}, selectAndClear: function(category_name) {
// set the category to the searchquery input this.searchquery = category_name;
// clear the result list this.results = [];
} } });
Laracasts has a decent video on how to get started: https://laracasts.com/series/search-as-a-service Code Blade Nepal also has some pretty good videos on Elasticsearch (https://www.youtube.com/watch?v=ZO7SBXcdBKw&list=PLl0rlrKS77MpXdRfD77mj6qAHOzu7Zqc2)
Regardless of what you choose there is a bit of a learning curve
Use passport.
I know its the typical answer and you already addressed it, but Passport is Laravel's official solution to exactly what you are trying to create.
Watch this video thats created by Taylor himself as a quick guide to setting up and configuring Passport https://laracasts.com/series/whats-new-in-laravel-5-3/episodes/13
Another skill you need to learn as a student is how to get help from other developers. Developers (including your co-workers) can't help you until they understand the problem. When the problem is "how to write code" you need to share code or provide a demo that is not working. You could use something like https://gist.github.com/ to show us the template / controller / javascript and then pose a question. If you cannot get a basic template / controller / model working I'd highly advise you go through this free video course https://laracasts.com/series/laravel-5-from-scratch
I assume you are using Laravel since you're in the Laravel subreddit.
If you are willing to pay for this, then you might as well use Forge : https://forge.laravel.com/
This service (created by the creator of Laravel) allows you to manage a server and install a Laravel app very easily via a web interface.
There's even a video series (free) on Laracasts explaining how Forge works: https://laracasts.com/series/server-management-with-forge/episodes/1
I started with Codeigniter (don't) and fumbled my way through Laravel for awhile before "getting it."
Do laracasts, watch the Laravel 5 Fundamentals series, and read the docs.
Then, learn by failing. Make sites, figure out why they're not great, make more sites (only better).
If you have a Laracasts subscription, I highly recommend this episode: https://laracasts.com/series/incremental-api-development/episodes/6
Basically you "abstract" the response messages into their own methods.
I implemented this system at work. We created an ApiController
which hold various methods like setStatusCode()
, respondWithError()
, 'respondWithValidationError()and
respond(). The actual Controller extends the
ApiController`.
Then you can do stuff like this:
$this->setStatusCode(422)->respondWithError('Validation failed!');
I would use laravel version 5, and go through that tutorial.
Then have a look at https://laracasts.com/series/whats-new-in-laravel-5-1 and learn the differences.
The basics of the laravel framework (and laravel mindframe) have not changed a lot between 5 and 5.1
What differences are you struggling with?
There's a really good Laracast video that covers this, but here's the snippet:
<div class="container"> @foreach(array_chunk($post->all(), 3) as $row) <div class="row"> @foreach($row as $post) <h2>{{ $post->title }}</h2> <article class="col-md-4"> <div class="body"> {{ $post->body }} </div> </article> @endforeach </div> @endforeach </div>
Laracasts. It costs money, but it'll be a huge help with learning Laravel.
Good idea is to get some books on Object Oriented Programming if you're not familiar with it. Can't recommend anything specific - google.
On Laravel 5, form authorization and validation is (mostly) handled for you out of the box.
This is a seriously awesome new feature. :)
I use Laravel as a backend API with Angular or other JS on the front, also.
I do the same things as /u/mbdjd but instead of over ridding the getter I convert my data to a view model before sending it to the front end. I do the timestamp conversion there.
Or...you can use accessor to do the conversion just for the date fields on the model.
Earlier on the Laravel site, I spotted these which may be of some use to you.
I'm assuming you are using auth attempt
http://laravel.com/docs/5.1/authentication
From where it talks about the attempt method:
"If the user is found, the hashed password stored in the database will be compared with the hashed password value passed to the method via the array. If the two hashed passwords match an authenticated session will be started for the user."
I see in your image that the passwords are plain text. So even if you pass the correct password in with the form the attempt method is calling bcrypt on your password sent in from the form. Once it is hashed it is not going to match the plan text password anymore.
I supposed you could go through the source and see how to keep it from bcrypting (if it will even let you), but the smarter and much safer thing to do is bcrypt your passwords before saving or updating them.
Hopefully that fixes your issue.
Edit: Going a bit further, instead of trying to remember to hash your passwords on save/update/db seeding just add an attribute mutator to the User class e.g.
public function setPasswordAttribute($password) { $this->attributes['password'] = bcrypt($password); }
Access the pivot
property on the relation to get the other fields, something like $character->pets->first()->pivot->level
. First though you need to add ->withPivot('level', 'other_field')
to your relationship. See http://laravel.com/docs/master/eloquent-relationships#many-to-many.
I don't know about the best practice, but if you have your Eloquent relationships set up you can use the sync() method where you pass in an array of hobby IDs that are in the final set. It will delete existing records that aren't in that final set and create those that aren't in the table yet.
Example from the documentation:
$user->roles()->sync([1, 2, 3]);
If I'm understanding you correctly, I think this is what you're looking for:
Key::with('value')->all();
From the docs
It's a bit strange that this would be removed from the docs, but here's an excerpt from the 5.0 docs:
> Note: The difference between the X-CSRF-TOKEN
and X-XSRF-TOKEN
is that the first uses a plain text value and the latter uses an encrypted value, because cookies in Laravel are always encrypted. If you use the csrf_token()
function to supply the token value, you probably want to use the X-CSRF-TOKEN
header.
For a bit more detail, you can read barryvdh's post on CSRF protection.
Glad you figured it out :) however, for something like that, personally I would be tempted to use resource controllers instead. They may be primarily designed for building REST interfaces, but I find them ideal for building admin panels too since they give you a means of listing (index), creating (create, store), updating (edit, update) and deleting (destroy) while only having to worry about a single parameter for each model.
It's even better if you combine it with model binding!
Here's a quick example:
Route::group(['prefix' => 'admin', 'namespace' => 'Admin'], function () { resource('news', 'NewsController'); });
Route::model('news', 'NewsArticle');
Then in your controller:
public function edit(NewsArticle $article) { return view('admin.article.edit', compact('article')); }
You can even be clever with your create() method and do this:
public function create() { return $this->edit(new NewsArticle); }
...and in your admin.article.edit view, you can do:
@if ($article->exists) Editing @else Creating @endif article (etc)
Anyway, you get the idea. Sorry if I'm pointing out things you already know about. This is just the approach I've ended up sticking with for the most part :)
I'd consider virtualization for the following reasons:
1) Your virtualized environment can be almost (if not exactly) identical to your eventual production server
2) You can make snapshots of your VM whenever you want, which backups not just the web site(s) but the entire configuration of the vm.
3) Portable. You've now decoupled your development environment from your host machine. If you need to switch machines, upgrade, downgrade, etc, it's super easy to move that VM to a new machine.
4) If you ever need to work with multiple frameworks or multiple versions of software that have different levels of dependency, you can setup multiple VM's with the exact requirements for that framework or software.
I believe most people use Homestead to setup Laravel 5. I personally don't have any experience with Homestead, as I prefer to setup my own environment myself running on Ubuntu 14.04 Server.
I used to use WAMPServer on Windows 7. Then I got vagrant and homestead and never looked back.
However, it is relatively simple: http://laravel.com/docs/5.0
Please note that using closures in routes is generally a bad idea. It breaks the single responsibility principle. I know that the official routing documentation has lot of closures but they are more for illustrative purposes I guess. 99% of the times you point them to resource controller and their methods.
http://laravel.com/docs/5.0/controllers#restful-resource-controllers
But generally I agree it is a good question why the official routing documentation has examples which are pretty much never used in real life. Now the most common use case in resource controllers, not in routing.
To add extra properties to a model, you just need these two pieces of your code in your model:
protected $appends = array('x');
protected function getXAttribute() { return 'abcd1234'; }
Replace 'x' with the relevant attribute. See: http://laravel.com/docs/eloquent#accessors-and-mutators
Please excuse my examples below, I'll draw an analogy.
You are a painter by profession. You say "I want to become a car mechanic" while you never touched a wrench before. So you buy yourself a car shop completely furnished, with right tools at the right places. You get yourself clients that need their cars fixed. You walk into your nice car shop and take client's car. The car needs a new transmission (or at least the client told you so). Where the heck is transmission? You have never seen how the car looks like on the underside. What are these bolts? How do you even lift the car up without breaking the frame? Etc...
See, the field of web development has evolved a lot in the past few years and it could be incredibly difficult to know all the bits and pieces that have changed and that have been brought in.
My suggestion is to take it a step at a time. While Laravel (and any other framework) make it super easy to make applications, you first need to catch up on the basic terminology, server management (I use free WAMP on Windows, MAMP on Mac OS - no need to make your life complicated by installing everything yourself), and then try again.
It would help if you knew why frameworks like Laravel exist. Basically when a web developer creates applications over and over, they come to some conclusions (that eventually become best practices) and so a set of common patterns emerges that becomes a framework.
Don't get discouraged, these resources can help you come to the right place: http://www.codecademy.com/tracks/php , Treehouse blog and videos, Laracasts - https://laracasts.com/series/laravel-from-scratch. There's a lot to learn but that's what web development is about - a technology that always moves forward.
This is called Stripe Connect and works exactly as you described. Admins connect their Stripe account (or create it on the spot) to your platform and you can charge users on their behalf, even taking your cut in the process.
All of this is done securely, you only have your API keys and unique identifiers (account IDs) - unique to your app - of the admins.
> Now, this fix doesn't work anymore.
Did the problem show up on/after September 30? The connection to wss won't succeed if there is a certificate problem. See: https://letsencrypt.org/docs/dst-root-ca-x3-expiration-september-2021/