laravel-4

How does Laravel queue work and what if php artisan queue:listen stops

南笙酒味 提交于 2021-02-06 10:48:09
问题 I have installed beanstaled and its working fine with laravel. The point where I am puzzled is that we have to do php artisan queue:listen to start listening queue. Right now, I am using it on amazone ec2 instance remotely through putty. but what is i close terminal? Will the jobs created through the code will work? Is it manually calling php artisan queue:listen or php artisan queue:work all time. Which does not seems fair. If once php artisan queue:listen done, will it keep on running even

Laravel Reset Password Using Different Column Name

主宰稳场 提交于 2021-02-04 16:09:31
问题 i managed to make it work when it comes to authorisation with different columns name either username, email or password. How to change / Custom password field name for Laravel 4 and Laravel 5 user authentication however the password reminder seems doesnt work. i have changed the user model, to my table column name. User Model: use Illuminate\Auth\UserTrait; use Illuminate\Auth\UserInterface; use Illuminate\Auth\Reminders\RemindableTrait; use Illuminate\Auth\Reminders\RemindableInterface;

Query relationship Eloquent

左心房为你撑大大i 提交于 2021-02-04 10:37:30
问题 I have News model, and News has many comments, so I did this in News model: public function comments(){ $this->hasMany('Comment', 'news_id'); } But I also have field trashed in comments table, and I only want to select comments that are not trashed. So trashed <> 1 . So I wonder is there a way to do something like this: $news = News::find(123); $news->comments->where('trashed', '<>', 1); //some sort of pseudo-code Is there a way to use above method or should I just write something like this:

Laravel routes not working as expected

戏子无情 提交于 2021-01-29 07:26:00
问题 I have just created UserController and added a route in the routes.php file: Route::resource('users', 'UserController'); When I visit laravel.dev/users I expected to see the user index view, but instead I get a 404 error: The requested URL /users was not found on this server. Here is the output when running: php artisan routes +--------+------------------------+---------------+------------------------+----------------+---------------+ | Domain | URI | Name | Action | Before Filters | After

Unable to CREATE PRIMARY INDEX for couchbase bucket. on UBUNTU 14.04

喜夏-厌秋 提交于 2021-01-29 03:50:44
问题 I am trying to get data from couchbase bucket using laravel 4.2 . And facing issue related to PRIMARY INDEX. Below are the details. Can someone please suggest where I am doing wrong. Thanks. Controller: <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Http\Requests; use CouchbaseCluster; class HomeController extends Controller { public function index() { // phpinfo();die; // $Cluster = New CouchbaseCluster ( 'http://127.0.0.1:8091' ); $Bucket = $Cluster->OpenBucket(

Unable to CREATE PRIMARY INDEX for couchbase bucket. on UBUNTU 14.04

扶醉桌前 提交于 2021-01-29 03:41:00
问题 I am trying to get data from couchbase bucket using laravel 4.2 . And facing issue related to PRIMARY INDEX. Below are the details. Can someone please suggest where I am doing wrong. Thanks. Controller: <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Http\Requests; use CouchbaseCluster; class HomeController extends Controller { public function index() { // phpinfo();die; // $Cluster = New CouchbaseCluster ( 'http://127.0.0.1:8091' ); $Bucket = $Cluster->OpenBucket(

Get all posts and check if user liked each post

て烟熏妆下的殇ゞ 提交于 2021-01-28 21:55:11
问题 I'm trying to create an Eloquent query that fetches all posts and checks if the user liked each of those posts. I have the following models: Post.php class Post extends Eloquent { /** * The database table used by the model. * * @var string */ protected $table = 'posts'; public function user() { return $this->belongsTo('User'); } public function likes() { return $this->hasMany('Like'); } } Like.php : class Like extends Eloquent { /** * The database table used by the model. * * @var string */

Redirect to contacts page after submitting form in laravel 4

♀尐吖头ヾ 提交于 2021-01-27 20:02:51
问题 I would like to redirect back to the contacts page once I have submitted my details. I have looked on solutions from the forums but I cannot get a solution. So far this is what I have: Route::post('sendmail', function() { Mail::send('emails.auth.mail', array('token'=>'SAMPLE'), function($message){ $message = Swift_Message::newInstance(); $email = $_POST['email']; $name = $_POST['name']; $message->setFrom(array($email => $name)); $message->setTo(array('name@name.com' => 'Jim Scott')); $subject

Wildcard URL routing in Laravel

瘦欲@ 提交于 2021-01-27 19:14:24
问题 I am attempting to create a set of routes in laravel. The first two are simple. / loads home /12345 loads a result for 12345 via ResultController, which I accomplished with {result}/ . The third route I would like is /12345/foo/bar/baz, which eventually will execute a second controller that presents files. Basically /foo/bar/baz represents the file location, so it could be any level of depth. I would like to pass it to the controller as a single value. I tried the below route to simply test

Global Mutator for Laravel

送分小仙女□ 提交于 2021-01-27 04:12:50
问题 I have many different locations ways of inserting and updating my database and I would like to be able to trim() the users input before inserting into the database. I know in the model I can do something like below, but I do not want to do this for every field. Is there a way to set a generic setter that works on all fields? Example: public function setSomFieldAttribute($value) { return $this->attributes['some_field'] = trim($value); } 回答1: You probably will be able to override those methods: