Skip to content
Advertisement

Tag: laravel

Deleting files after download in laravel

I’m creating a application that lets a user download a file. After the download i want the file to be deleted. The end of my code is like this: which means that the function ends on the return an i am not able to delete the file. I have tried to call a ‘after’ filter on the route but then

installing laravel –prefer-dist

I am following the Laravel installation on their website and I came across this line composer create-project laravel/laravel –prefer-dist Now, what exactly does the –prefer-dist part mean? I can’t see anything on their documentation. Thanks in advance. Answer It’s all available here: https://getcomposer.org/doc/03-cli.md#install –prefer-dist: Reverse of –prefer-source, composer will install from dist if possible. This can speed up installs substantially

Laravel: getting a single value from a MySQL query

I’m trying get a single value from MySQL database using laravel but the problem I’m getting an array . this is my query result in MySQL command line: my laravel function: expected $data value is a string with value= Admin but what i get is : [{“groupName”:”Admin”}] Answer Edit: Sorry i forgot about pluck() as many have commented : Easiest

PHP: How to split array into 2 parts?

I have an array full of DB records. It could heaps of elements or very little, it changes regularly. I need to split the array into two equal parts. The reason is I am then passing these arrays to a Laravel view and displaying them into separate columns. Here is the DB records being pulled: $books = Book::where(‘unitcode’, ‘=’, $unitcode[‘unitcode’])->get();

Advertisement