How to cache relation on laravel 5.5

here is in my controller $posts = Post::where(array('status' => Post::STATUS_PUBLISHED)) ->with('inners') ->orderBy('created_at', 'DESC')->paginate(8); here is my relation public function inners() { ...
more »

2017-10-02 11:10 (0) Answers

Implicit route model binding 401 unauthorized

I have a super simple learning app. My Laravel version is 5.5.13. A User can create a Pet. I am implicitly throwing 404 but I need to also implicitly throw 401 is this possible? Details on setup: Pet model: class Pet extends Model { protected ...
more »

2017-10-02 09:10 (1) Answers

Filter collection using like and wildcard

I need to get all files which starts with desired letter, I'm trying to use a ->where filter adding 'like' as operator but wildcards doesn't work. $files = File::files(storage_path($id_files)); $files = collect($files); $f...
more »

2017-09-29 12:09 (1) Answers

How can I configure an SCP/SFTP file storage?

My Laravel application should copy files to another remote host. The remote host is accessible only via SCP with a private key. I would like to configure a new file storage (similarly as FTP), but I have found no information, how to define an SCP dri...
more »

2017-09-26 16:09 (1) Answers

Remove index.php from URL of Laravel

I am using Laravel 5.5.12 in Linux Mint.I am using LAMP stack. I would like to remove index.php from URL. My mod_rewrite apache module enabled. My .htaccess file located in public folder and it contains following code. <IfModule mod_rewrite.c>...
more »

2017-09-23 15:09 (0) Answers

laravel 5.5 best way to create data

I have a codes for create new data, but im comfuse what is the best way to insert new data in database using laravel 5.5. Codes 1: $user = User::create([ 'name' => $request->name, 'username' => $request->username, 'email' ...
more »

2017-09-22 02:09 (3) Answers

Laravel : Auth::login() not starting the session

I am creating an authentication across two database it means users are able to authenticate either Database A table users or Database B table user_account. So right now, I am stacked to this problem. If I try to login using the credentials of Databa...
more »

2017-09-18 03:09 (0) Answers

Where to put response messages in laravel api?

In my laravel 5.5 api I have a lot of response message like "You successfully completed some action..". At the moment I have stored them as constants in the controller they are used. I want to move all of them to a single location, so if I need to ...
more »

2017-09-14 13:09 (4) Answers

User Roles in Laravel 5.5

What is the most effective method to add User roles in Laravel 5.5? I came across a couple of methods i.e. Admin Middleware Pivot Table for user_roles I've tried and implemented both methods in my application but asking this question by keepin...
more »

2017-09-14 10:09 (3) Answers

Laravel 5.5 install not generating .env file

I have installed laravel 5.4 multiple times. Now I'm trying to install laravel 5.5 using same command And it doesn't work. composer create-project --prefer-dist laravel/laravel blog dev-develop It doesn't seem to have any errors on installation, o...
more »

2017-09-05 12:09 (4) Answers

Laravel eloquent multiple table join with filter

There are theree tables in my system. Students Articles categories Student can write many articles and a article is belong to just one student. And A Article can have only one category. Controller public function all_articles_by_student_by_cate...
more »

2017-09-01 12:09 (2) Answers