laravel-5.6

Laravel check if job extends a certain class

99封情书 提交于 2019-12-10 11:54:29
问题 I know you can listen to job events using before , after and failing hooks: https://laravel.com/docs/5.6/queues#job-events Queue::before(function (JobProcessing $event) { // $event->connectionName // $event->job // $event->job->payload() }); I only want certain jobs to be picked up here though. These jobs are the ones that extend from a certain abstract base class called AbstractTask . Normally I would simply perform an instanceof check but something like this won't work: $job instanceof

Laravel Map DB Column Names Using Proper Convention to Actual DB Column Names in Model

自作多情 提交于 2019-12-10 11:54:07
问题 We're building a portal to replace part of an existing application as step one, but the DB schema holds to absolutely no conventions. Aside from the lack of any constraints, indexes, etc the names of columns are not descriptive and not snake-cased. Is it possible to map DB table column names so that the portal uses proper descriptive and snake-cased column names like first_name but writes to the actual database column first to at least have the portal be a first step towards cleaning up the

laravel remember me not working

时间秒杀一切 提交于 2019-12-09 07:00:02
问题 I have created 2 different login forms for admin and users in admin login form i have used attempt function i want to use remember me functionality but when i log in to the system without clicking remember me checkbox i can see in database it stores some value is it normal that its storing values not checking remember me token ? this is my code for admin login if (Auth::guard('admin')->attempt(['email' => $request->email, 'password' => $request->password], $request->remember)) { // if

Should I use CloudFront together as TemporaryUrl for sensitive files in s3

亡梦爱人 提交于 2019-12-08 12:03:57
问题 I have a project where I was storing files in the server itself. The storage is increasing so I need to use a bucket. I thought s3 is the way to go. The issue is the pdf files are sensitive and I don't want to open them to public. I read about a service called CloudFront but then the new feature of Laravel TemporaryUrl as well. So as far as I understand, I shouldn't just use s3, but I should use TemporaryUrl too. Do I need to use CloudFront too? So s3 -> CloudFront -> TemporaryUrl ? Or was

How can I pass parameter in the laravel excel?

青春壹個敷衍的年華 提交于 2019-12-07 18:28:17
问题 I get tutorial from here : https://laravel-excel.maatwebsite.nl/docs/3.0/export/basics <?php ... use App\Exports\ItemsDetailsExport; class ItemController extends Controller { ... public function exportToExcel(ItemsDetailsExport $exporter, $id) { //dd($id); I get the result return $exporter->download('Summary Detail.xlsx'); } } My export like this : <?php namespace App\Exports; use App\Repositories\Backend\ItemDetailRepository; use Maatwebsite\Excel\Concerns\FromCollection; use Maatwebsite

How to override default login mechanism of Laravel 5.6?

徘徊边缘 提交于 2019-12-07 12:35:20
问题 I want the user to login only if status field in users table is set to 1 . If it is 0 then simply return error stating user account is not active . So after creating the status field in the table, where can I make the check that the user'status is 1 then only login otherwise throw error. I tried to find where the default auth check is made but cannot find it anywhere. 回答1: You need to simply override credentials() which is defined in AuthenticatesUsers.php . the default login method use

JWT/LARAVEL token expired

馋奶兔 提交于 2019-12-06 16:24:18
问题 I developed an API and I have a problem with the expiration of the token, and I try to find ways to refresh the tokens sent by API and I found nothing This is my user mdoal: <?php namespace App; use Tymon\JWTAuth\Contracts\JWTSubject; use Illuminate\Notifications\Notifiable; use Illuminate\Foundation\Auth\User as Authenticatable; class User extends Authenticatable implements JWTSubject { use Notifiable; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [

Ubuntu - Laravel 5.6 - Unable to load ffprobe (using php-ffmpeg)

霸气de小男生 提交于 2019-12-06 16:12:05
I have ffmpeg and ffprobe installed on my ubuntu system (can access it via command line) ffmpeg and ffprobe are located in /usr/bin/ I installed these via composer "php-ffmpeg/binary-driver": "dev-master", "php-ffmpeg/php-ffmpeg": "^0.11.1", I've done: use FFMpeg; // in index() function// $ffmpeg = FFMpeg\FFMpeg::create([ 'ffmpeg.binaries' => '/usr/bin/ffmpeg', 'ffprobe.binaries' => '/usr/bin/ffprobe' ]); and still get FFMpeg \ Exception \ ExecutableNotFoundException Unable to load FFProbe I have looked at about 30 forums for this and no luck, some direction would be helpful UPDATE I tried

Symfony parse error in output.php when creating project in laravel

北战南征 提交于 2019-12-06 05:37:10
问题 Installed laravel 5.6 Have PHP 7.0 installed as well. When I try laravel new sample-project it creates the required files and dependencies but bails with an error below: PHP Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) in /home/johndoe/laravel/sample-project/vendor/symfony/console/Output/Output.php on line 40 Have a feeling this might be due to issues with the symfony file but not sure how to go about getting the right version or making a change in Output.php

Want to implement web sockets in Laravel

孤街醉人 提交于 2019-12-05 19:44:09
问题 I want to implement web notifications in Laravel using web sockets. I have tried pusher. It is very easy but it is a paid package. I have also tried redis and socket.io for which I have to install horizon. I am running Windows and I cannot install it on Windows according to what I have read about horizon. So I am very confused about push notification. I am trying for at least one week but haven't found any solution yet. My front end is in angluar 5/android and backend is in Laravel 5.6. Can