scottbear scottbear - 6 months ago 109
PHP Question

Laravel Missing argument 1 in get()

I am trying to get all records from a table named 'producers', but I get the following error.

Missing argument 1 for Illuminate\Support\Collection::get(), called in /var/www/html/wines/storage/framework/views/ac350063efb624ac50d199628897fd7d72bc196c.php on line 63 and defined (View: /var/www/html/wines/resources/views/admin/producers.blade.php)

Here are my files:

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateProducerTable extends Migration {
public function up()
Schema::create('producers', function (Blueprint $table) {
public function down()

My ProducerController

namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
class ProducerController extends Controller {
public function __construct() {
} }

The producer model:

namespace App;
use Illuminate\Database\Eloquent\Model;
class Producer extends Model {
protected $table = 'producers';
protected $fillable = [
'id','producer_name', 'phone_number','user_id','avatar'
protected $hidden = [

Then when I use

public function admin_producers() {
return view('admin.producers',array('user'=>Auth::user(),'producer'=>Producer::get()));

on the controller to get all my records I get that error. I have also tried with Producer::all() but with the same result, no luck.
I am doing something stupid here?


The Eloquent all() method will return all of the results in the model's table. Use get() only, when you need to add constraints to queries.

So, use all() instead of get().