laravel-4

laravel mail queueing - Insufficient data for unserializing

大兔子大兔子 提交于 2019-12-12 03:08:10
问题 I am using Ubuntu laravel 4.2 beanstalked when i try to php artisan queue:work it returns [ErrorException] Insufficient data for unserializing - 1403 required, 218 present mail function (confide package) Mail::queueOn( Config::get('confide::email_queue'), Config::get('confide::email_account_confirmation'), compact('user'), function ($message) use ($user) { $message ->to($user->email, $user->username) ->subject(Lang::get('confide::confide.email.account_confirmation.subject')); } ); 回答1: I came

Showing orders of user in laravel

◇◆丶佛笑我妖孽 提交于 2019-12-12 03:02:29
问题 I'm trying to give ability on user to see his orders. How can I query the database.. I'm trying something like this but I got empty page.. I mean nothing from database. May be my query ins't correct. This is my controller public function viewOrders() { $user_order = self::$user->user_id; $orders = Order::where('user_id', '=', $user_order); return View::make('site.users.orders', [ 'orders' => $orders ]); } Am I getting correctly user_id here? I'm not sure... Update: I have this in my User

Controlling Access to Routes Laravel and Sentry

余生颓废 提交于 2019-12-12 02:57:29
问题 I am wondering how I can restrict access to certain routes in the routes.php file when using Sentry . Currently I have the following routes set up Route::model('book', 'Book'); Route::get('/books', 'BookController@index'); Route::get('book/create', 'BookController@create'); Route::get('book/edit/{book}', 'BookController@edit'); Route::get('book/delete/{book}', 'BookController@delete'); Route::get('book/view/{book}', 'BookController@view'); Route::post('book/create', 'BookController

Laravel 4: replicate to table

拈花ヽ惹草 提交于 2019-12-12 02:48:14
问题 how to clone table row from one table to another i found way to make a clone but dont know how to insert it in other table I have Data class and Product class and I want to clone from Data to Product one row only public function getClone($id) { $item = Data::find($id); $clone = $item->replicate(); unset($clone['created_at'],$clone['updated_at']); $product = new Product; --> what goes here i tried $product->fill($clone); But i get error: must be of the type array, object given return Redirect:

Laravel5 Redirect to external URL with params

杀马特。学长 韩版系。学妹 提交于 2019-12-12 02:37:05
问题 I've gone through the following page, but I can't find any examples at all: http://laravel.com/docs/5.1/responses#redirects. I've tried the following: return redirect()->away('http://bla.com'); This works, but as soon as you add params to it you get the following error message PHP: return redirect()->away('http://bla.com', ['bla' => 'bla']); ERROR: InvalidArgumentException in Response.php line 470: The HTTP status code "1" is not valid. 回答1: Just add them to the string. return redirect()-

Can't retrieve a one to many relationship in Laravel 4

帅比萌擦擦* 提交于 2019-12-12 02:28:09
问题 I'm trying to get to a ProfileType through my User model, i.e. $user->profile->profiletype; I'm not able to retrieve an object, however. Basically, User hasOne Profile, and Profile belongsTo User and ProfileType. ProfileType hasMany Profile. My table names are users, profiles and profile_types. models/User.php use Cartalyst\Sentry\Users\Eloquent\User as SentryUserModel; class User extends SentryUserModel { /** * Indicates if the model should soft delete. * * @var bool */ protected $softDelete

How to create a blob in MongoDB using laravel

怎甘沉沦 提交于 2019-12-12 02:27:03
问题 I am using Laravel4 PHP Framework, my web application has to handle JSON format APIs. First part of My problem is, each time when i get a subscription, deviceID and listID (where list ID is the the list which was subscribed by the device having deviceID) is received by the web application. For each deviceID received we have to create a blob having deviceID like { deviceID:........, subscription:[{listID:1},{listID:2}.......] } when the same device subscribe multiple list i have to update

Laravel 4.2 Loging Mails from Swift Mailer

跟風遠走 提交于 2019-12-12 02:24:28
问题 In my project I need to log each mail I send from my application. Mail::queue('email.template', $vars, function($message) { $message->to('someone', 'Her name')->subject("<3"); LogModel::log($message); }); and in LogModel public static function log(Message $message) { $msg = $message->getSwiftMessage(); $log = new self; $log->to = $msg->getTo(); $log->subject = $msg->getSubject(); $log->cc = $msg->getCc(); $log->bcc = $msg->getBcc(); $log->body = $msg->getBody(); $log->headers = serialize($msg

Eloquent Fatal error: Call to undefined method Eloquent\Collection::addEagerConstraints() in \illuminate\database\Eloquent\Builder.php on line 451

自作多情 提交于 2019-12-12 02:22:24
问题 I am following a tutorial where you can save relationships in one table to determine if a user is friend of another user and viceversa. In my case, I need to save in a relational table boundTogether_projects those projects that are bound together. So inside the Project.php Model I created the following Eloquent relationships: <?php /*** Bound together projects ***/ public function projectsBoundToThisOne(){ return $this->belongsToMany('Models\User\Project', 'boundTogether_projects', 'bound_id'

Laravel Eager Loading and Form Model Binding

血红的双手。 提交于 2019-12-12 02:13:37
问题 I have a User model and via Eager Loading i am loading also the Table Profile. To Display it i just write $user->profile->nameOfTheProfilePropertyIWant just as normal. Simple. But how exactly do i use Form Model Binding now? Normal i would use Form::text('nameOfTheUserPropertyIWant') for a User Property like an email. But i want to set in on a Property of the Profile like the location. (profile->location) But how can i set it to an profile property? 回答1: You may do this (in a one-to-one