laravel-5.2

Laravel 5 schedule job every 30 seconds

我们两清 提交于 2019-12-01 13:57:28
I am using Laravel schedule to run cron jobs. In my crontab I have added (with correct path to my project): * * * * * php /path/to/artisan schedule:run >> /dev/null 2>&1 Now my App\Console\Kernel.php looks like: protected function schedule(Schedule $schedule) { $schedule->command('investments:calculate_interests')->everyMinute(); $schedule->call('\App\Http\Controllers\UsersController@testEvent')->everyMinute(); } Using it like that I successfully run jobs every minute. But how I can change it to run them on every 10 or 20 or 30 seconds? I solved it with this code: public function handle() {

Mysql MySQL or PHP Transform rows to two columns dynamically

雨燕双飞 提交于 2019-12-01 11:29:28
I have the same scenario as I have in MySQL or PHP Transform rows to columns But I have to restructure my table now and this is the output It's pretty much the same with the link above but I to include the AS_amount.anyone can help me? I want the result below but with AS_month_2016...etc in the right side of each FA_mont2016 This is my code: CREATE DEFINER=`root`@`localhost` PROCEDURE `display_annualize_table`() BEGIN SET group_concat_max_len=10028; SET @sql = NULL; SELECT GROUP_CONCAT(DISTINCT CONCAT( 'MAX(IF(month = ''', month, ''' and year(date) = ', year(date), ', FS_amount, NULL)) AS `',

Laravel blade use $(document).ready function

对着背影说爱祢 提交于 2019-12-01 09:25:47
I'm trying to use laravel blade templates including some javascript code into child view. I have my mail app.blade.php file, where is placed string of jquery initialization: <script src="/js/jquery.min.js"></script> In my subview file settings.blade.php I want to use some jquery functions: @extends('layouts.app') @section ('content') Settings main page @endsection <script type="text/javascript"> $(document).ready(function() { alert("Settings page was loaded"); }); </script> But in browser console I get an error message Uncaught ReferenceError: $ is not defined which seems like jquery was

Laravel Associate method is returning empty array in the view

佐手、 提交于 2019-12-01 09:00:11
问题 I am working on a simple social network, i am working on the replies section now. I associated the post/status model with user as below, but when i tried to access in the view it returns empty array [] . Reply function in Post Model public function postReply(Request $request, $statusId){ $this->validate($request, [ "reply-{$statusId}" => 'required|max:1000', ], [ 'required' => 'The reply body is required' ] ); $post = Post::notReply()->find($statusId); if(!$post){ return redirect('/'); } if(

Mysql MySQL or PHP Transform rows to two columns dynamically

微笑、不失礼 提交于 2019-12-01 08:24:45
问题 I have the same scenario as I have in MySQL or PHP Transform rows to columns But I have to restructure my table now and this is the output It's pretty much the same with the link above but I to include the AS_amount.anyone can help me? I want the result below but with AS_month_2016...etc in the right side of each FA_mont2016 This is my code: CREATE DEFINER=`root`@`localhost` PROCEDURE `display_annualize_table`() BEGIN SET group_concat_max_len=10028; SET @sql = NULL; SELECT GROUP_CONCAT

laravel 5 csrf_token value is Empty

匆匆过客 提交于 2019-12-01 06:42:48
Why laravel 5 csrf_token value is empty always ? How can i get that token value ? I tried, {!! csrf_token !!} , {{ csrf_token }} and {{ Form::open() }} ....{{ Form::close() }} MY OUTPUT <input type="hidden" name="_token"></input> Victor Hugo Avelar It's because you're not using the web group middleware. Laravel is smart enough to know that if you're not using that group a token is not necessary. Try moving your route inside the Route::group(['middleware' => 'web'] ... and tell us about it :) Source: I made the same mistake not too long ago. I stumbled across this post having spent the

Laravel blade use $(document).ready function

落爺英雄遲暮 提交于 2019-12-01 06:39:02
问题 I'm trying to use laravel blade templates including some javascript code into child view. I have my mail app.blade.php file, where is placed string of jquery initialization: <script src="/js/jquery.min.js"></script> In my subview file settings.blade.php I want to use some jquery functions: @extends('layouts.app') @section ('content') Settings main page @endsection <script type="text/javascript"> $(document).ready(function() { alert("Settings page was loaded"); }); </script> But in browser

Selenium and Laravel 5.2

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 04:19:02
I'm getting sad, I use Laravel 5.2 and I am developping my unit tests. In Laravel 5.1, you could use the great Integrated lib to use selenium, but it doesn't seem to work in Laravel 5.2 So basically, Is there any kind of integration between L5.2 and Selenium, or is it imposible to use it nicely? In this case, I should definitively have stayed in L5.1 as testing is a fundamental part of my app :( You need to install PHPUnit_selenium package using composer composer require --dev phpunit/phpunit-selenium Create Selenium Test Case class inside laravel/tests/ <?php class SeleniumTestCase extends

Selenium and Laravel 5.2

安稳与你 提交于 2019-12-01 01:47:20
问题 I'm getting sad, I use Laravel 5.2 and I am developping my unit tests. In Laravel 5.1, you could use the great Integrated lib to use selenium, but it doesn't seem to work in Laravel 5.2 So basically, Is there any kind of integration between L5.2 and Selenium, or is it imposible to use it nicely? In this case, I should definitively have stayed in L5.1 as testing is a fundamental part of my app :( 回答1: You need to install PHPUnit_selenium package using composer composer require --dev phpunit

How protect .env file laravel

ぐ巨炮叔叔 提交于 2019-12-01 01:07:28
问题 I move my project to HOST but i can access .env with address mysite.com/.env and display this file with all variables and secure data. my .env file : APP_ENV=local APP_DEBUG=true APP_KEY=base64:xxxxxxx APP_URL=http://localhost DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=xx DB_USERNAME=xx DB_PASSWORD=secret CACHE_DRIVER=file SESSION_DRIVER=file QUEUE_DRIVER=sync REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379 MAIL_DRIVER=smtp MAIL_HOST=mailtrap.io MAIL_PORT=2525