laravel

How to send data colected with Laravel Livewire to Fortify?

≡放荡痞女 提交于 2021-01-28 18:35:14
问题 I'm not familiar with Vue.js at all, so found a good replacement using Livewire. The challenge that I've got to solve is to have a user friendly registration on my website using Fortify + Livewire. The registration process is a multistep one and depends on the choices that the user makes it will load the relative fields. So far I set up the Fortify views by adding in the FortifyServiceProvider.php file the following code: Fortify::loginView(function () { return view('auth.login'); }); Fortify

Laravel nova diffForHumans DateTime

ⅰ亾dé卋堺 提交于 2021-01-28 18:32:44
问题 I have field last_active on users, I want display time with diffForHumans or time_from_now from Moment.js. How I can do it? Now I just use: DateTime::make('Activiy', 'last_active') ->exceptOnForms(), When I use: DateTime::make('Activiy', 'last_active')->diffForHumans() ->exceptOnForms(), I get undifined method diffForHumans . 回答1: To my knowledge at the moment DateTime only supports format . Since you want only to display, you can try Text field & display the humanise value. Text::make(

Eloquent - join table on itself

喜夏-厌秋 提交于 2021-01-28 18:29:43
问题 I'm trying to join a table on itself but keep getting errors. Here is my current code. I've also tried Raw statement. Not sure which direction to go in at the moment. My code: $Calle = db('VoipBill') ->table('billing') ->join('billing', 'billing.srcnum', '=', 'billing.dstnum') ->where('acct_name', '100080_company') ->where('srcnum', $call->srcnum) ->whereBetween('calldate', [$set_time_lower, $set_time_upper]) ->get(); This is the error: SQLSTATE[42000]: Syntax error or access violation: 1066

Pass argument to python script running in a docker container

℡╲_俬逩灬. 提交于 2021-01-28 15:15:45
问题 Suppose the following setup: Website written in php / laravel User uploads a file (either text / doc / pdf) We have a docker container which contains a python script for converting text into a numpy array. I want to take this uploaded data and pass it to the python script. I can't find anything which explains how to pass dynamically generated inputs into a container. Can this be done by executing a shell script from inside the laravel app which contains the uploaded file as a variable

Pass argument to python script running in a docker container

拟墨画扇 提交于 2021-01-28 15:07:27
问题 Suppose the following setup: Website written in php / laravel User uploads a file (either text / doc / pdf) We have a docker container which contains a python script for converting text into a numpy array. I want to take this uploaded data and pass it to the python script. I can't find anything which explains how to pass dynamically generated inputs into a container. Can this be done by executing a shell script from inside the laravel app which contains the uploaded file as a variable

Laravel 5.5: Execute a method before registration

Deadly 提交于 2021-01-28 14:51:30
问题 I'm using the default laravel authentication. Every user who registeres in my site needs a activation pin. The valid PINs are stored in a different table. Whenever a user registeres, I want to test if the PIN is valid or not. So, is there any method that I can override in RegisterController that executes before regstering the user? 回答1: Yes. You can override protected register method in RegisterController. This is a simple solution. I do this to validate params, save a new user, and force

Redirect to login page on “page not found” - Laravel 5.4

家住魔仙堡 提交于 2021-01-28 14:39:29
问题 I want to make so that if the user is not logged in and the page is not found (unexisting route), the user to be redirected to the login page instead to show the 404 page. If the user is logged in then the 404 page should be displayed. I'm using Laravel 5.4. 回答1: You can listen for any exception in App\Exceptions\Handler@render : if ($e instanceof NotFoundHttpException) { if ( \Auth::guest() ) { return redirect()->to('/login'); } return response()->view('errors.404', [], 404); } Don't forget

Redirect to login page on “page not found” - Laravel 5.4

我怕爱的太早我们不能终老 提交于 2021-01-28 14:36:51
问题 I want to make so that if the user is not logged in and the page is not found (unexisting route), the user to be redirected to the login page instead to show the 404 page. If the user is logged in then the 404 page should be displayed. I'm using Laravel 5.4. 回答1: You can listen for any exception in App\Exceptions\Handler@render : if ($e instanceof NotFoundHttpException) { if ( \Auth::guest() ) { return redirect()->to('/login'); } return response()->view('errors.404', [], 404); } Don't forget

Laravel with PostgreSQL in sslmode

孤人 提交于 2021-01-28 14:21:46
问题 I'm working on a project using AWS, hosted on an EC2 instance with a RDS PostgreSQL. I'm wanting to make use of SSL encryption between my server and database, something AWS RDS supports but I can't figure out how to configure Laravel to make it work. Is there a way to specify sslmode when configuring a database connections? 回答1: This seems to be a missing feature in Laravel 4, but I have submitted a pull request to fix this. https://github.com/laravel/framework/pull/5488 (was merged on 2014

Laravel: Where to Add booted and booting Callbacks?

别等时光非礼了梦想. 提交于 2021-01-28 14:07:57
问题 The main Laravel application object has two methods, booting and booted . These methods allow you to configure callbacks. The application object will call these callbacks before and after it boots. Where, as a Laravel application developer, can I hook into these events? Looking at the framework it seems like bootstrap/start.php is the obvious place — but if I put code here it'll be zapped in the next update. There's also start/global.php statt/{$env}.php but these files are actually required