laravel-5.1

Processing multiple files in Laravel 5.1 (as an API)

倾然丶 夕夏残阳落幕 提交于 2019-12-14 03:55:43
问题 So this seems like a pretty basic thing but I can't find a lot of documentation online about what's going on.... I'm trying to run through a list of files using Laravel 5.1 and I can only return/process/see the first file. I'm using Postman to send the request to the API (so I know multiple is enabled in the POST request) and then iterating through that a few different ways: public function files(Request $request) { foreach($request->files as $file) { var_dump($file); } } even: public

laravel query returns weird order

限于喜欢 提交于 2019-12-14 03:49:23
问题 So I came across a bug in my ' bugoverview ' page. (how ironic).. this weird way of order came to my knowledge after an bug was deleted out of the database ( id : 7 was deleted) Anyways the problem is as seen in the picture : I get all the rows in a simple blade foreach. my query codes are : $bugs_all = Bug::with('klant','user')->orderBy('id','asc')->get(); and $projects_all = Project::all(); my foreach code : @foreach($projects_all as $project) @foreach($bugs_all as $bug) @if(count($bugs_all

Laravel 5.1 prevent CSRF mismatch from throwing exception [duplicate]

。_饼干妹妹 提交于 2019-12-14 03:48:57
问题 This question already has answers here : Laravel catch TokenMismatchException (4 answers) Closed 4 years ago . I am getting issues with CSRF exceptions being thrown to the user. They happen for perfectly innocent reasons like if someone takes too long to fill out a form when they finally submit it the session has expired and the tokens don't match. Now obviously this is an error but it doesn't need to kill everything and throw an exception. Is there a way to just get it to set a flash message

laravel redirect if logged in

心不动则不痛 提交于 2019-12-14 03:39:27
问题 i am using laravel 5.1.8. i am making a login/registration system. i made a controller named AdminController and protect it with middleware. but i am using laravel's default AuthController which methods and classes are located in different locations. where routes are: Route::Controllers([ 'auth' => 'Auth\AuthController', 'password' => 'Auth\PasswordController' ]); get('admin', 'AdminController@index'); get('profile', 'AdminController@profile'); get('article', 'AdminController@article'); users

Displaying feeds and blogs according to the created time

大憨熊 提交于 2019-12-14 03:20:55
问题 I'm having a home page where all the feeds along with comments and blogs are being displayed. Right now it is showing first all the feeds and then the blog. But I want it should be displayed according to the created time, mixer of feeds and blog not like first feed will come and then the blog. Can anyone tell me how to acheive that. This is my index.blade.php @extends('layouts/default') {{-- Page title --}} @section('title') Home @parent @stop {{-- page level styles --}} @section('header

Controller Variable not Showing up in Query Builder Laravel

大憨熊 提交于 2019-12-14 03:20:02
问题 I am encountering a strange issue in Laravel. The below is an index function in one of my controllers. public function index($merchant_url_text) { // $deals = DB::table('tbl_deal') -> join ('tbl_merchant', 'tbl_deal.merchant_id', '=', 'tbl_merchant.merchant_id') -> where ('merchant_url_text', $merchant_url_text) -> toSql(); //return $merchant_url_text.$deal_id; dd($deals); //return $merchant_url_text; } As you can see I am passing merchant_url_text from route. Route::get('/testroute/{merchant

how to check if user is logged in by his session in route and then call controller method in laravel?

為{幸葍}努か 提交于 2019-12-14 02:03:43
问题 I'm using Laravel 5.2. I want to check user session in routes file, so that if session is set user can visit dashboard otherwise redirect to login page. I have used following code for this but it's not working. It's not giving any error and not redirecting him to login page. anyhow if I write same code in controller functioin, it works fine. Route::group(['middleware' => ['web']], function () { Route::get('dashboard/index', ['uses' => 'DashboardController@index'], function() { $value =

JavaScript parse Error

百般思念 提交于 2019-12-13 23:40:23
问题 I am using laravel 5.1 PHP framework and a sign chart from a javascript, But when i send data from controller with ' (single quote) but JavaScript Parse as some undefined value $data_B_Temp = "{x : new Date('".$piecesTime[$dataLength]."'), y :".$pieces[$dataLength]."}"; this variable will make a graph point input as $(function () { var chart = new CanvasJS.Chart("TempChart", { axisX:{ title: "time", gridThickness: 2, interval:1, intervalType: "hour", valueFormatString: "hh TT K", labelAngle:

Laravel 5.1: How to set Route for update record

╄→гoц情女王★ 提交于 2019-12-13 16:26:17
问题 I am working with laravel 5.1 I am using the routes of laravel. I used Form/Html for insert/update, but stuck in routing of update record. Here is route for redirect to edit page in routes.php Route::get('/company/edit/{id}','CompanyMasterController@edit'); In my CompanyMasterController.php public function edit($id) { $company = CompanyMasters::find($id); return view('companymaster.edit', compact('company')); } My action in edit.blade.php {!! Form::model($company,['method' => 'PATCH','action'

Laravel - Session variable is null in Service Provider

泪湿孤枕 提交于 2019-12-13 13:04:01
问题 I'm trying to share a Session value with all views using AppServiceProvider class. In the boot() function I said: view()->share('key', Session::get('key')); But, the value is null . What can be the problem? In the Controller I'm setting it, it works fine. Even after removing the Session::put() line, the value is still in the session (obviously). 回答1: In Laravel session is initialized in a middleware that is handled by this class: \Illuminate\Session\Middleware\StartSession::class When the