laravel-4

Is safe to store an access token in a client cookie if the cookie is not send to the server

筅森魡賤 提交于 2019-12-06 08:49:31
问题 I'm developing a backbone application with a REST api to a Laravel back end. It means that I authenticate on every request, using the access token that I receive from the social media (eg. Facebook, Google, etc). My plan was to store a client side cookie generated with Javascript to store the access token, so that I can send it to the back end to authenticate the user with my application, and so that it is possible to request resources on the server of the social medium (such as friends list,

Public Available Function in Laravel 4

◇◆丶佛笑我妖孽 提交于 2019-12-06 07:55:03
问题 If I would like to make a function in Laravel, that is available everywhere in my app, how would I go about that? What I mean, is that, if I create a function called resizeimage() and would like to call it from anywhere in my Laravel application, how can I do this? 回答1: Create a folder named: libraries Create a file(class) in your library: Image.php Then add this code to Image.php : <?php class Image{ public static function resizeImage($image){ return $image; } } Edit global.php in your

Push Notification in Laravel 4

我的未来我决定 提交于 2019-12-06 07:53:06
I am using Laravel 4 and I have a push notification system . I had research and found a library support to : https://github.com/davibennun/laravel-push-notification I have configured as guide and when I run my routes as below : Route::get('/push',function(){ $push = new \Davibennun\LaravelPushNotification\PushNotification(); $push->app('appNameAndroid')->to('My-device-token')->sent('my message'); } It displayed an error : Zend \ Http \ Client \ Adapter \ Exception \ RuntimeException Unable to enable crypto on TCP connection android.googleapis.com: make sure the "sslcafile" or "sslcapath"

Laravel/PHP - returning/redirecting from child class

寵の児 提交于 2019-12-06 07:44:34
This is my child controller: class VolunteersController extends \BaseController { public function index() { $this->checkForRoles(['admin']); //list some secret stuff for admin } } In my base controller I did this: class BaseController extends Controller { protected function checkForRoles($roles) { foreach ($roles as $role) { if (!(Auth::user()->hasRole($role))) { return Redirect::to('/'); } } } } Now what I expected was that the line return Redirect::to('/'); in BaseController would redirect the user to home page if his role is not admin. But it does not happen. //list some secret stuff for

Laravel Rest Authentication when post via HttpClient Android

醉酒当歌 提交于 2019-12-06 07:36:08
How can I filter the laravel rest app, just authenticated userid and correct password when I post via android HttpClient? I try to find the best way, but get no best sample. This is my code: public static int LogExceptionError(final ExceptionLog exceptionLog) { final HttpResponse[] response = new HttpResponse[1]; new Thread(new Runnable() { public void run() { // Create a new HttpClient and Post Header HttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(AndroidHelperUtility.getBaseUrl("exceptionlog/create", AndroidHelperUtility.IS_DEBUG_MODE)); try { Gson gson =

Install FPDF on Laravel 4

旧城冷巷雨未停 提交于 2019-12-06 07:31:46
问题 I didn't manage to install FPDF on laravel 4. Can you help me? Can you explain how to do it step by step? I add on composer.json "require": { "illuminate/support": "4.0.x" }, "require-dev": { "anouar/fpdf": "dev-master" }, after this, on shell, I use composer update. And now? 回答1: To your composer.json file, add: "require-dev": { "anouar/fpdf": "dev-master" } Then update your Laravel project, composer update If not already installed laravel framework use, composer install Then go to app

Laravel 4 - Showing edit form with OLD data input as well as DB information

别来无恙 提交于 2019-12-06 07:21:52
问题 Im making a edit form for my app and i was wondering if someone could tell me how to get the data from the database into my text field. I can locate the record i need to edit based on the users click, and i can display the information if i do the following: value="{{ $letter->subject }}" BUT, the problem im having is that when i run it through the validation and there is an error, it comes back with the database information instead of the OLD data. So my questions is. Is there a way to serve

Laravel/Angular: passing data within php page to angularjs

倾然丶 夕夏残阳落幕 提交于 2019-12-06 07:21:27
问题 I have the following laravel html/blade page and i want to pass in a storeid that then can get picked up via angular to then use to get and do some workings with. Below is how i am accomplishing it NOW but is there a better way to produce the same? Blade Partial <div ng-controller="storeChartCtrl" data-storeid="{{ $store['id'] }}"> <p>{{ $store['name'] }} Sales</p> ... </div> Angular Ctrl .controller('storeChartCtrl', ['$scope', 'Store', function($scope, Store){ //-- get the requested store

Laravel 4 Authentication not working with Subdomains

落花浮王杯 提交于 2019-12-06 07:20:17
问题 In my L4 App i use subdomains for my routing to different stuff. accounts.domain.com = where alle the Authentication stuff happens dashboard.domain.com = The main frontpage for authenticated users community.domain.com = Community stuff for authenticated users. If someone visits community.domain.com/forum and is not autenticated he should be send to accounts.domain.com, login and then get redirected back to the Forum. But now i have 2 problems. 1 and major problem: afer the login the user is

Could not find driver while migrating on Laravel 4 using XAMPP Server Linux (Ubuntu)

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-06 07:01:40
问题 I have installed Laravel 4.1 everything worked just fine, but when I try to use migration it throws a PDO Exception saying: [PDOException] could not find driver I found many answers on StackOverFlow, but none of them solved my problem, unfortunately. I have tried to enable pdo extension and pdo_mysql extension, but it says that pdo is already loaded. I have tried to reinstall PDO and PDO MySQL but nothing worked. I am using XAMPP Server on a Ubuntu 64bit machine. Thank you in advance. 回答1: If