laravel-4

Laravel mail bcc

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 02:10:32
I am using the default Laravel Mail class to send emails. I am trying to add bcc to myself, but when I add a bcc the email is not send at all. Here is my code: Mail::send( 'emails.order.order', array( 'dateTime' => $dateTime, 'items' => $items ), function($message) use ($toEmail, $toName) { $message->from('my@email.com', 'My Company'); $message->to($toEmail, $toName); $message->bcc('mybcc@email.com'); $message->subject('New order'); } ); I have found the problem. I didn't use the correct parameters for $message->bcc('mybcc@email.com'); I had to write email AND name: $message->bcc('mybcc@email

How to make Laravel's Validator $rules optional?

痴心易碎 提交于 2019-12-04 01:46:57
问题 Let's say I have User model with two methods: User.php class User extends Eloquent { /* Validation rules */ private static $rules = array( 'user' => 'unique:users|required|alpha_num', 'email' => 'required|email' ); /* Validate against registration form */ public static function register($data) { $validator = Validator::make($data, static::$rules); if($validator->fails()) { /*... do someting */ } else { /* .. do something else */ } } /* Validate against update form */ public static function

cannot use class because it is not a trait

最后都变了- 提交于 2019-12-04 01:38:38
I have followed the tutorial here on building a validation service for laravel. I am having issues now when trying to call the validator from one of my controllers. I am seeing the error: validController cannot use Portal\Service\Validation\Laravel\AppInstancesValidator - it is not a trait here is my controller: class validController extends BaseController { use \Portal\Service\Validation\Laravel\AppInstancesValidator; public function validateInstance() { $post = Input::all(); $instVal = new AppInstancesValidator( App::make('validator')); return $instVal->with($post)->passes(); } } and my

How to insert an object (Model type object) into Collection Object in Laravel at specific index number?

扶醉桌前 提交于 2019-12-04 01:31:03
I have read Dayle Rees's Code Bright to know more about Eloquent Collection s used in Laravel. Did some other research as well but couldn't find the answer I was looking for. I want to insert an object ( Model type object) into a Collection Object at a specific position. For example: This is the returned collection Illuminate\Database\Eloquent\Collection Object ( [0] => Attendance Object ([present_day] => 1) [1] => Attendance Object ([present_day] => 2) [2] => Attendance Object ([present_day] => 4) [3] => Attendance Object ([present_day] => 5) ) As you can see above [present_day] have a values

error: git was not found - installing laravel with composer windows

别来无恙 提交于 2019-12-04 01:09:31
问题 I'm getting an error saying: failed to clone https://github.com/php-fig/log.git, git was not found, check that it is installed and in your PATH env. 'git' is not recognized as and internal or external command, operable program or batch file when I try and run composer create-project laravel/laravel learning-laravel . I installed the git GUI which also comes with a command line shell, but I don't know why its not recognising the command (I'm issuing the create-project command in the normal

Laravel - RuntimeException - Could not scan for classes inside “app/tests/TestCase.php”

空扰寡人 提交于 2019-12-04 00:54:41
I've been using Laravel to display a custom blog for a month or so now and it's been working perfectly. I just took a look at my site and it's saying: /vendor/symfony/security/Symfony/Component/Security/Core/Util/SecureRandom.php): failed to open stream: No such file or directory Having looked in the folders the location of the above file is actually: /vendor/symfony/security-core/Symfony/Component/Security/Core/Util/SecureRandom.php): failed to open stream: No such file or directory but I haven't changed this? If I try and run composer update I get this error: root@server [/laravel]# composer

Pluck together with first using Query builder

帅比萌擦擦* 提交于 2019-12-04 00:54:00
问题 If I want to get get name of first user in database using eloquent I can do something like that: $user = User::select('name')->first()->pluck('name'); // or $user = User::first()->pluck('name'); echo $user; to get only name of this user as string. However If I try the same using only query builder: $user = DB::table('users')->select('name')->first()->pluck('name'); echo $user; I get exception: Call to undefined method stdClass::pluck() But without using first it will work: $user = DB::table(

Laravel 4 - Trying to get property of non-object

邮差的信 提交于 2019-12-04 00:52:10
问题 I have been working with Laravel 4.1 to create a book list app with user relationships. I have the user relationships working however when I added the pagination I get the following Error Exception: ErrorException Trying to get property of non-object (View: /app/views/books/index.blade.php) return link_to_route('user.books.show', $book->title, [$book->user->username, $book->id]); The error generates from the view (book/index.blade.php) but the error exception actually comes from the helper

How to use php artisan migrate command of Laravel4 in Heroku?

[亡魂溺海] 提交于 2019-12-04 00:35:01
I am suing Heroku dev plan for creating database using PostgreSQL . Database is created in Heroku. After running heroku pg:info command $ heroku pg:info === HEROKU_POSTGRESQL_XXX_URL Plan: Hobby-dev Status: available Connections: 1 PG Version: 9.3.1 Created: 2013-11-27 04:00 UTC Data Size: 6.4 MB Tables: 0 Rows: 0/10000 (In compliance) Fork/Follow: Unsupported Rollback: Unsupported Result shows zero tables, which is correct. In my local machine tables are created by using following command which are supported in Laravel4 framework. php artisan migrate php artisan db:seed But it seems like I

laravel NotFoundHttpException

江枫思渺然 提交于 2019-12-04 00:23:25
问题 I am new at laravel. I am trying to make a link to another page. I have the page index and want to go to desc which display information about a vehicle selected in index page. The problem is that it shows the error: Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException index.blade.php @foreach ($cars as $car) <tr> <td> {{link_to_action('CarController@show', $car->Description, $car->id)}}</td> {{ Form::open(array('action' => 'CarController@show', $car->id)) }} {{ Form::close() }