laravel-5.1

Laravel 5.1 Task Scheduling on Windows

浪尽此生 提交于 2019-12-21 03:16:16
问题 I'm trying to get Laravel 5.1 Task Scheduling working on IIS. When I run a batch file using Windows task manager it will run the task one time only. How can I get ->everyMinute() to work? Windows batch file: cd c:\inetpub\myapp c:\PROGRA~2\PHP\php.exe artisan schedule:run 1>> NUL 2>&1 The kernel: class Kernel extends ConsoleKernel { protected $commands = [ \App\Console\Commands\MyCommand::class, ]; protected function schedule(Schedule $schedule) { $schedule->command('test')->everyMinute(); }

How to select year and month from the created_at attributes of database table in laravel 5.1?

旧城冷巷雨未停 提交于 2019-12-20 17:42:28
问题 My problem is that I want to get data form the database table from the created_at attributes as per year and month only. The code I have tried is: $post= Mjblog::select(DB::raw('YEAR(created_at) year, MONTH(created_at) month')); $posts_by_y_m = $post->where('created_at',$post)->get(); 回答1: There are date helpers available in the query builder: $post = Mjblog::whereYear('created_at', '=', $year) ->whereMonth('created_at', '=', $month) ->get(); 回答2: If you want to get the year and month from a

Convert from Core PHP to Laravel framework [closed]

↘锁芯ラ 提交于 2019-12-20 06:36:35
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 years ago . How to convert a Core PHP web application to Laravel Framework. Is there any tool available to do that? Or is there any procedure to make this possible and easier. I am in need of converting this with in a short duration. Suggest me with all the possibilities of this conversion

FIND_IN_SET with two strings

為{幸葍}努か 提交于 2019-12-20 05:45:09
问题 I have this EMPLOYEE table of employees list +-----+---------------+-------------+ | ID |EMPLOYEE_ID | SKILLS | +-----+---------------+-------------+ | 1 | 1 | 3,4 | +-----+---------------+-------------+ | 2 | 2 | 3,5,2 | +-----+---------------+-------------+ | 3 | 3 | 1,5 | +-----+---------------+-------------+ and table POSTED_JOB listing jobs +-----+---------------+-------------+ | ID |POSTED_JOB_ID | JOB_SKILLS | +-----+---------------+-------------+ | 1 | 1 | 1,2,3 | +-----+-------------

Laravel and Angular js file upload

大憨熊 提交于 2019-12-20 05:35:29
问题 How I can save images with laravel and angular js ? are more inputs , but that work for me , are of type text My index: <div class="container" ng-app="todoApp" ng-controller="todoController"> <h1>Profile</h1> <div class="row"> <div class="col-sm-4"> <div class="form-group"> <h4>Foto de perfil: </h4> <div class="input-group"> <span class="input-group-btn"> <span class="btn btn-primary btn-file"> Browse… <input type='File' name="photo" ng-model="todo.photo" class="image-upload"required/> </span

handle multiple post requests to same url Laravel 5

大憨熊 提交于 2019-12-20 04:51:55
问题 I have two forms on a page both submits the data via POST method . I want to handle both requests on the same url i.e /home and use different controllers and methods for both forms. Below are the two routes. Route::post('home' ,'FacebookControllers\PostsController@save'); Route::post('home' , 'FacebookControllers\MessageController@storeMessage'); In PostsController@save I am checking if(isset($_POST['submitPost']) && $_SERVER['REQUEST_METHOD']=='POST'){ //do something } and in

Laravel - How to pass variable to reset password template?

删除回忆录丶 提交于 2019-12-20 03:39:48
问题 I have implemented reset password functionality with Laravel 5 and getting email. Now how to pass some variable data to my email template to display more information about user. /** * Send a reset link to the given user. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function postEmail(Request $request) { //echo Input::get('ID'); die; $this->validate($request, ['ID' => 'required|email']); $UserProduct = "Sample 1"; // I want to pass this variable to

Laravel How to store extra data/value in session Laravel

倾然丶 夕夏残阳落幕 提交于 2019-12-20 02:27:36
问题 I'm using default auth() in laravel login (email & password) Now i try to take input from the user in text field like (Age or City) Now i want to store (Age/City) in my session. Help me 回答1: You can use session() helper: session('age', 18); // saves age into session $age = session('age')`; // gets age from session Update If you want to save Age and City after user registration, you should store this data in a DB, not in a session. You can add some fileds in create method of app\Http

Laravel Validation: required_with_all condition always passing

独自空忆成欢 提交于 2019-12-20 01:40:08
问题 As per laravel validation documentation: required_with_all:foo,bar,... The field under validation must be present only if all of the other specified fields are present. Here is my test: Route::get('/test/{param}', function($param) { $screenRules = array( 'foo' => 'string', 'param' => 'required_with_all:foo', ); $validator = Validator::make(array('param' => $param), $screenRules); if($validator->fails()) { echo '<pre>'; print_r($validator->errors()); echo '</pre>'; die('Dying now!'); } else {

Laravel cookie in serviceprovider not comparable

被刻印的时光 ゝ 提交于 2019-12-19 12:46:11
问题 I try to pass a variable based on a cookie value in my compose function to all my view to build my menu, with the use of serviceproviders recommmended here: File: Providers/ViewComposerServiceProvicer.php public function boot(Request $request) { $this->composeTopBar($request);} public function composeTopBar(Request $request) { $cookieValue = $request->cookie('brand'); // if value not set use default value. if($cookieValue == null) { $cookieValue = 1; } $brands = \App\Brand::orderBy('priority'