I am working along with @Jeffrey_way series of Laracasts Many to Many Relations (With Tags) Below is the code I have written in CMD using Laravel Tinker: After executing the last line of code ($article->tags()->toArray(); Although everything seems to be OK with my code but still I get following error: Answer If you want to actually “get” relational data, you
Tag: laravel-5
Laravel 5.2 – Selecting only articles that has comments
I built a commenting system, and I’m working on a page that shows all the comments that are waiting for approval. The relationship: Article.php public function comments() { return $this->…
How to validate current, new, and new password confirmation in Laravel 5?
I have created the password route, view and method in UserController@getProfilePassword and UserController@postProfilePassword At the moment, if I fill out the new_password field, it gets hashed and …
How to use memcached and apc together in laravel?
I want to use both memcached and apc at the same time for caching, how can I configure and use it in laravel.
How to Display Validation Errors Next to Each Related Input Field in Laravel 5?
Default solution is trivial: and I can include errors.blade.php anywhere. Is there any way to extract each element and display it next to input field that holds the value that failed? I assume that would require me to define a lot of conditional if statements next to each input, right? How to sort this problem? Could you give me any
Laravel 5 : how to acces in a field on the hasMany table?
i have two models linked with hasMany to many relationship and there are my tables structure clients = id|title…etc roles = id|title…etc client_role = id|client_id|role_id|desc everythings works …
Drop Unique Index Laravel
I kept getting this while run php artisan migrate SQLSTATE[42000]: Syntax error or access violation: 1091 Can’t DROP ’email’; check that column/key exists While I see that email is exist on my database. My migration script. I was trying to drop the unique constraint. Did I forget to clear any caches ? Any hints for me ? Answer When dropping
Manually register a user in Laravel
Is it possible to manually register a user (with artisan?) rather than via the auth registration page? I only need a handful of user accounts and wondered if there’s a way to create these without having to set up the registration controllers and views. Answer I think you want to do this once-off, so there is no need for something
Custom defined routes not resolving in Laravel
I have a Laravel 5.2 instance utilizing all the typical out-of-the-box routes for dashboard, cases, home, login/logout, and users (which is working well). I now need to create a wizard with steps (step1, step2, step3, etc.), and I need access to the session. I assigned them to the group middleware. However, when I go to the named route(s), I get
Laravel: How to access session value in AppServiceProvider?
Is there any way available to access Session values in AppServiceProvider? I would like to share session value globally in all views. Answer You can’t read session directly from a service provider: in Laravel the session is handled by StartSession middleware that executes after all the service providers boot phase If you want to share a session variable with all