laravel-4

response to ajax with file doesn't work

戏子无情 提交于 2019-12-11 10:37:18
问题 I use jquery jtable send ajax to get excel file from server but Response::download doesn't work $writer = (new WriterFactory())->createWriter(new Excel5(public_path().'/file/myExport.xls')); $phpExcel = $writer->convert($workbook); $writer->write($phpExcel); Response::download(public_path().'\file\myExport.xls'); 回答1: Javascript cannot access file system, you cannot use ajax to download files. Try using an iframe pointing to the file to download it. <iframe id="downloadFrame" style="display

How to edit package on vendor laravel 4

徘徊边缘 提交于 2019-12-11 10:31:30
问题 i was working in my application and i'm using some packages, but i have the necessity to change or add some logic in it. I read that we must don't change code of the packages when they are on the vendor directory, but i didn't find how i can do instead. any ideas? 回答1: This differs from package to package. The one-size-fits-all solution is to fork the package, essentially copying it and modifying code in the replicated version. Often, packages may offer methods to extend or build on their

Migrating users table from Laravel to Ruby and using BCrypt to decode passwords does not work

余生颓废 提交于 2019-12-11 10:28:00
问题 I am migrating users table from a laravel application to a ruby SSO server, and I am using BCrypt to validate passwords in ruby. The problem i am facing is that passwords do not match because the Hash generated by laravel starts with $2y$10..... and my BCrypt generates a hash $2a$10.... The versions between the two hashes do not match. Ruby BCrypt shows version 2a , instead laravel 2y How can i bring them on the same version so i can do user authentication in ruby like this? BCrypt::Password

Undefined property: Illuminate\Queue\Jobs\BeanstalkdJob:: $name

那年仲夏 提交于 2019-12-11 10:26:29
问题 I'm using beanstalkd with Laravel to queue some tasks but I'm having trouble to send data to the function that handles the queue , Here is my code //Where I call the function $object_st = new stdClass(); $object_st->Person_id = 2 ; //If I do this: echo($object_st->Person_id); , I get 2 Queue::push('My_Queue_Class@My_Queue_Function', $object_st ); And the function that handle the queue is the following public function My_Queue_Function( $Data ) { $Person_id = $Data->Person_id; //This generate

Laravel 4 inside Wamp does not work

自闭症网瘾萝莉.ら 提交于 2019-12-11 10:13:03
问题 I want to use Laravel in my projects, but I faced a problem. Namely, I'm already using WAMP server as local server... I followed the instructions for installing Laravel inside WAMP... so I enabled openSSL first, then downloaded Composer, then tried composer command in the CMD, everything was fine so far... then created project... Composer has downloaded the dependencies... and everything looked perfect, but when I try localserver/myProject/public I get Parse error: syntax error, unexpected T

Laravel permission issue in windows [closed]

余生颓废 提交于 2019-12-11 09:58:30
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . I downloaded the laravel from server to my local windows8 xampp->htdocs folder. Below is the error i am getting. Error in exception handler: The stream or file "C:\xampp\htdocs\laravel\app\storage/logs/log-apache2handler-2014-12-11.txt" could not be opened: failed to open stream: Permission denied in C:\xampp

how to use different namespaces in a controller in laravel 4.1

爷,独闯天下 提交于 2019-12-11 09:45:40
问题 What I want to do is to use different namespaces in a controller. I have a tree scheme like this: app/ app/controllers/ app/modules/ app/modules/modulename/ app/modules/modulename/controllers/ app/modules/modulename/controllers/modulecontroller.php app/modules/modulename/models/ app/modules/modulename/models/modulemodel.php What I want to do is to call a model from a controller in app/controllers/ folder. Therefore I am supposed to add namespace as follows: use App\Modules\Facebook

Laravel 4 : In nested relationship, how do I eager load and retrieve just the first/last data?

无人久伴 提交于 2019-12-11 09:42:16
问题 A : User, B : Conversations, C : Messages I want to get the conversation together with it's most recent message in an A->B->C relationship from A. Working relationships in model User belongsToMany Conversation Conversation belongsToMany User Conversation hasMany Message Message belongsTo Conversation User hasMany Message Message belongsTo User **note: User and Conversation are related to a many2many relationship connected by a pivot table I've tried $user->load(['conversations' => function($q

Laravel 4.2 Composer install error: Could not scan for classes inside “app/models”

陌路散爱 提交于 2019-12-11 09:38:10
问题 In my Laravel 4.2 project I have moved my User model to a new directory within my app directory. -app/ --Acme/ ---Users/ ----User.php I then removed the app/models directory I added this to my composer.json file "autoload": { "classmap": [ "app/commands", "app/controllers", "app/models", "app/database/migrations", "app/database/seeds", "app/tests/TestCase.php", "app/Acme/adminHelpers.php" ], "files": [ "app/Acme/helpers.php", "app/Acme/adminHelpers.php" ], "psr-4": { "Acme\\": "app/Acme" } },

laravel how to prefix all json responses to protect against json injection

夙愿已清 提交于 2019-12-11 09:35:15
问题 This topic has been request Laravel - how to Prefix all json responses to protect against json injection without any reply so I try again. I've tried with Route::filter('protectionJson',function($route,$request ,$response) { if($request->ajax() && ($response instanceof \Illuminate\Http\JsonResponse)){ return ")]}',\n".json_encode($response->getData()); } }); Route::get('user', array('as' => 'base.user.index', 'uses' => 'App\Controllers\UserController@index'))->before('hasAccess:users')->after