laravel-5.2

Date Compare in validation Laravel 5.2

二次信任 提交于 2019-12-10 12:08:26
问题 I want to compare two date in validation. I mean the user will input start date and end date .I want to verify the start date, it can't be yesterday . And end date will not be before day of start date. Please guide me in laravel validation. 回答1: I would suggest you to make your custom validation for dates, Place the following function in your App\Providers\ValidationServiceProvider class boot() method //end date must be equal to value or greate than value Validator::extend('dateequalorearlier

How to autofill Edit form with old Information of a user?

眉间皱痕 提交于 2019-12-10 12:07:33
问题 i have this form "Modifier Technicien" with which I will modify the information of a technician, the modifications will affect two tables of my database table user and table technician. I want my form to be autofilled with the information of the technician I chose to modify. Thank you edit.blade.php @extends('Layouts/app') @extends('Layouts.master') @section('content') <div class="container"> <div class="row"> <div class="col-md-10"> <h1>Modifier Technicien</h1> <form action="{{ route(

Sending Audio Blob to server

旧城冷巷雨未停 提交于 2019-12-10 11:29:53
问题 I am trying to send an audio blob produced by WebAudio API and Recorder.js to my Laravel Controller using jQuery's $.post method. Here is what I am trying. $('#save_oralessay_question_btn').click(function(e){ var question_content = $('#question_text_area').val(); var test_id_fr = parseInt($('#test_id_fr').val()); var question_type = parseInt($('#question_type').val()); var rubric_id_fr = $('#rubric_id_fr').val(); var reader = new FileReader(); reader.onload = function(event){ var form_data =

View pdf instead of download using PDF js

对着背影说爱祢 提交于 2019-12-10 11:02:15
问题 In my page, I'm trying to display a thumbnails of my pdf using PDF JS and it works on local, but when I upload my code in my webserver the pdf file is auto download. In my local : Code : $(function() { var filePath = "http://example.com/public/uploads/docs/Document_One_1.pdf"; function Num(num) { var num = num; return function () { return num; } }; function renderPDF(url, canvasContainer, options) { var options = options || { scale: 1.1 }, func, pdfDoc, def = $.Deferred(), promise = $

Delete method with Sweet Alert in Laravel

青春壹個敷衍的年華 提交于 2019-12-10 10:47:46
问题 I'm testing a method using Sweet Alert, to improve the messages issued by the Javascript alert method with the laravel framework. 1 - I downloaded the files sweetalert.css and sweetalert.min.js. 2 - So I connect the files from app.blade.php <!-- Sweet Alert --> <link href="{{ asset('/dist/css/sweetalert.css') }}" rel="stylesheet"> <!-- Sweet Alert --> <script src="{{ asset('/dist/js/sweetalert.min.js') }}"></script> 3 - I created the delete button using the onclick event of Javascript and the

Cant Download Excel file When calling Laravel Controller from AngularJS

瘦欲@ 提交于 2019-12-10 10:07:34
问题 Hi I am sending some data to laravel controller from angularjs and based on that data i want get data from sql table and download as excel file.But i am unable to download the file Angular code $scope.sendSetField = function (selected_list) { var arr = []; angular.forEach(selected_list, function(value, key){ arr.push(key); }); //console.log(selected_list); $http.post("http://localhost/maxo_ats_v1.00/dashboard/jobsDownload",arr) .then(function(response) { }); Laravel Controller : public

Laravel 5: Check if event date range is not already taken

拥有回忆 提交于 2019-12-10 10:05:10
问题 I'm creating calendar for few days events and the events can not overlap. But event can start/end when another event starts/ends. In Laravel, in my event model table I am storing start and end date of events. How can I check before storing new event do database, if it is valid (is not overlapping with existing events, excluding margin/boundary days) ? In advance thank You very much for Your help. 回答1: You can use following code to get the correct counts for events booked between certain times

Laravel overriding EloquentUserProvider to change password field name in validateCredentials()

筅森魡賤 提交于 2019-12-10 06:46:44
问题 I've managed to change the password field in the code through overriding various classes/methods. But I after trying to override EloquentUserProvider and it's validateCredentials() method I keep getting an error - ErrorException in AuthUserProvider.php line 15: Argument 1 passed to App\Providers\AuthUserProvider::__construct() must be an instance of App\Helpers\Sha1Hasher, instance of Illuminate\Foundation\Application given I created an override App\Providers\AuthUserProvider.php - namespace

Laravel, convert JSON array to Array and only get one object from the Array

老子叫甜甜 提交于 2019-12-10 04:34:08
问题 <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use Vinelab\Http\Client as HttpClient; use App\Requests\SearchRequest; use App\Http\Requests; use App\Http\Controllers\Controller; class SearchResults extends Controller { public function index() { return view('results.search-results'); } public function store(Requests\SearchRequest $request) { $search_phrase = $request->input('search'); $client = new HttpClient; $response = $client->get('https://www.reddit.com/search.json?q='

Laravel 5.2 Event Testing: expectsEvent not seeing the event fired although it is being fired

送分小仙女□ 提交于 2019-12-10 04:04:58
问题 I have been trying to test events and I had it working yesterday. That was before I started to refactor the test code to keep it from being too repetitious. I added the setUp method call to generate the fake data using ModelFactories. This was done in each test case yesterday and as stated it was working. I am thinking it has something to do with using the setUp method but I have no idea why that would be the case. First I attempted to use setUpBeforeClass() static method as that is only run