Using get() with Laravel 5How do I get PHP errors to display?Get the first element of an arrayHow do I get a YouTube video thumbnail from the YouTube API?Get the full URL in PHPLaravel/Ardent - on save(), error: Relationship method must return an object of type IlluminateAuth::user() returns nullLaravel Logging in userMenu in laravel 5 Multiple levels?Laravel Socialite Package ErrorLaravel 5.7 - “orderBy” Not Sorting Results

Meaning and structure of headline "Hair it is: A List of ..."

Why do aircraft leave cruising altitude long before landing just to circle?

May the tower use the runway while an emergency aircraft is inbound?

Can planar set contain even many vertices of every unit equilateral triangle?

Designing a prison for a telekinetic race

What exactly happened to the 18 crew members who were reported as "missing" in "Q Who"?

How to render "have ideas above his station" into German

Trying to understand how Digital Certificates and CA are indeed secure

Regression when x and y each have uncertainties

Subgroup generated by a subgroup and a conjugate of it

Why can't I see 1861 / 1871 census entries on Freecen website when I can see them on Ancestry website?

Did Michelle Obama have a staff of 23; and Melania have a staff of 4?

Output the list of musical notes

Combinatorial Argument for Exponential and Logarithmic Function Being Inverse

How does the illumination of the sky from the sun compare to that of the moon?

Can anybody tell me who this Pokemon is?

Expressing a chain of boolean ORs using ILP

The Lucky House

Programming a recursive formula into Mathematica and find the nth position in the sequence

Are unaudited server logs admissible in a court of law?

Is a suspension needed to do wheelies?

What's a good pattern to calculate a variable only when it is used the first time?

Number of matrices with bounded products of rows and columns

How do the Durable and Dwarven Fortitude feats interact?



Using get() with Laravel 5


How do I get PHP errors to display?Get the first element of an arrayHow do I get a YouTube video thumbnail from the YouTube API?Get the full URL in PHPLaravel/Ardent - on save(), error: Relationship method must return an object of type IlluminateAuth::user() returns nullLaravel Logging in userMenu in laravel 5 Multiple levels?Laravel Socialite Package ErrorLaravel 5.7 - “orderBy” Not Sorting Results






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have a Laravel 5 app that I'm trying to get data from two different tables: Endpoint table and Audits table. They are referencing each other by Endpoints.id and Audits.endpoint_id. I'm trying to get the audits for that specific endpoint but keep running into errors like Too few arguments to function IlluminateSupportCollection::get()



Here are my files:



OnDemandController.php



public function index()


$endpoints = auth()->user()->endpoints->where('is_ondemand', true);

$endpoint = $endpoints->get();

$mobileAudits = $endpoint->audits()->where('strategy', 'mobile')->first();
$desktopAudits = $endpoint->audits()->where('strategy', 'desktop')->first();

return view('ondemand.index', compact('endpoints', 'mobileAudits', 'desktopAudits'));




index.blade.php



 @forelse($endpoints as $endpoint)
$desktopAudits->id - $mobileAudits->id
@empty
nope
@endforelse


Endpoint Model



protected $guarded = [];

protected $requestedAudits = null;

public function audits()

return $this->hasMany(Audit::class);



Any help would be greatly appreciated.



Thanks!










share|improve this question



















  • 2





    ->endpoints returns a collection, while ->endpoints() returns the query builder. $endpoints may already have what you want, but if not, use ->endpoints()

    – aynber
    Mar 27 at 13:36











  • @aynber not quite sure I understand, can you provide an example please?

    – Trey Copeland
    Mar 27 at 14:03











  • What are you trying to accomplish with get()? $endpoints should already have what you need.

    – aynber
    Mar 27 at 14:10












  • Is "is_ondemand" from User? If yes, you could try auth()->user()->where('is_ondemand', true)->endpoints()->get()

    – JoaoGRRR
    Mar 27 at 14:12











  • @JoaoGRRR is_ondemand is from endpoints

    – Trey Copeland
    Mar 27 at 14:19

















0















I have a Laravel 5 app that I'm trying to get data from two different tables: Endpoint table and Audits table. They are referencing each other by Endpoints.id and Audits.endpoint_id. I'm trying to get the audits for that specific endpoint but keep running into errors like Too few arguments to function IlluminateSupportCollection::get()



Here are my files:



OnDemandController.php



public function index()


$endpoints = auth()->user()->endpoints->where('is_ondemand', true);

$endpoint = $endpoints->get();

$mobileAudits = $endpoint->audits()->where('strategy', 'mobile')->first();
$desktopAudits = $endpoint->audits()->where('strategy', 'desktop')->first();

return view('ondemand.index', compact('endpoints', 'mobileAudits', 'desktopAudits'));




index.blade.php



 @forelse($endpoints as $endpoint)
$desktopAudits->id - $mobileAudits->id
@empty
nope
@endforelse


Endpoint Model



protected $guarded = [];

protected $requestedAudits = null;

public function audits()

return $this->hasMany(Audit::class);



Any help would be greatly appreciated.



Thanks!










share|improve this question



















  • 2





    ->endpoints returns a collection, while ->endpoints() returns the query builder. $endpoints may already have what you want, but if not, use ->endpoints()

    – aynber
    Mar 27 at 13:36











  • @aynber not quite sure I understand, can you provide an example please?

    – Trey Copeland
    Mar 27 at 14:03











  • What are you trying to accomplish with get()? $endpoints should already have what you need.

    – aynber
    Mar 27 at 14:10












  • Is "is_ondemand" from User? If yes, you could try auth()->user()->where('is_ondemand', true)->endpoints()->get()

    – JoaoGRRR
    Mar 27 at 14:12











  • @JoaoGRRR is_ondemand is from endpoints

    – Trey Copeland
    Mar 27 at 14:19













0












0








0








I have a Laravel 5 app that I'm trying to get data from two different tables: Endpoint table and Audits table. They are referencing each other by Endpoints.id and Audits.endpoint_id. I'm trying to get the audits for that specific endpoint but keep running into errors like Too few arguments to function IlluminateSupportCollection::get()



Here are my files:



OnDemandController.php



public function index()


$endpoints = auth()->user()->endpoints->where('is_ondemand', true);

$endpoint = $endpoints->get();

$mobileAudits = $endpoint->audits()->where('strategy', 'mobile')->first();
$desktopAudits = $endpoint->audits()->where('strategy', 'desktop')->first();

return view('ondemand.index', compact('endpoints', 'mobileAudits', 'desktopAudits'));




index.blade.php



 @forelse($endpoints as $endpoint)
$desktopAudits->id - $mobileAudits->id
@empty
nope
@endforelse


Endpoint Model



protected $guarded = [];

protected $requestedAudits = null;

public function audits()

return $this->hasMany(Audit::class);



Any help would be greatly appreciated.



Thanks!










share|improve this question














I have a Laravel 5 app that I'm trying to get data from two different tables: Endpoint table and Audits table. They are referencing each other by Endpoints.id and Audits.endpoint_id. I'm trying to get the audits for that specific endpoint but keep running into errors like Too few arguments to function IlluminateSupportCollection::get()



Here are my files:



OnDemandController.php



public function index()


$endpoints = auth()->user()->endpoints->where('is_ondemand', true);

$endpoint = $endpoints->get();

$mobileAudits = $endpoint->audits()->where('strategy', 'mobile')->first();
$desktopAudits = $endpoint->audits()->where('strategy', 'desktop')->first();

return view('ondemand.index', compact('endpoints', 'mobileAudits', 'desktopAudits'));




index.blade.php



 @forelse($endpoints as $endpoint)
$desktopAudits->id - $mobileAudits->id
@empty
nope
@endforelse


Endpoint Model



protected $guarded = [];

protected $requestedAudits = null;

public function audits()

return $this->hasMany(Audit::class);



Any help would be greatly appreciated.



Thanks!







php laravel






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 27 at 13:34









Trey CopelandTrey Copeland

2,6634 gold badges20 silver badges36 bronze badges




2,6634 gold badges20 silver badges36 bronze badges










  • 2





    ->endpoints returns a collection, while ->endpoints() returns the query builder. $endpoints may already have what you want, but if not, use ->endpoints()

    – aynber
    Mar 27 at 13:36











  • @aynber not quite sure I understand, can you provide an example please?

    – Trey Copeland
    Mar 27 at 14:03











  • What are you trying to accomplish with get()? $endpoints should already have what you need.

    – aynber
    Mar 27 at 14:10












  • Is "is_ondemand" from User? If yes, you could try auth()->user()->where('is_ondemand', true)->endpoints()->get()

    – JoaoGRRR
    Mar 27 at 14:12











  • @JoaoGRRR is_ondemand is from endpoints

    – Trey Copeland
    Mar 27 at 14:19












  • 2





    ->endpoints returns a collection, while ->endpoints() returns the query builder. $endpoints may already have what you want, but if not, use ->endpoints()

    – aynber
    Mar 27 at 13:36











  • @aynber not quite sure I understand, can you provide an example please?

    – Trey Copeland
    Mar 27 at 14:03











  • What are you trying to accomplish with get()? $endpoints should already have what you need.

    – aynber
    Mar 27 at 14:10












  • Is "is_ondemand" from User? If yes, you could try auth()->user()->where('is_ondemand', true)->endpoints()->get()

    – JoaoGRRR
    Mar 27 at 14:12











  • @JoaoGRRR is_ondemand is from endpoints

    – Trey Copeland
    Mar 27 at 14:19







2




2





->endpoints returns a collection, while ->endpoints() returns the query builder. $endpoints may already have what you want, but if not, use ->endpoints()

– aynber
Mar 27 at 13:36





->endpoints returns a collection, while ->endpoints() returns the query builder. $endpoints may already have what you want, but if not, use ->endpoints()

– aynber
Mar 27 at 13:36













@aynber not quite sure I understand, can you provide an example please?

– Trey Copeland
Mar 27 at 14:03





@aynber not quite sure I understand, can you provide an example please?

– Trey Copeland
Mar 27 at 14:03













What are you trying to accomplish with get()? $endpoints should already have what you need.

– aynber
Mar 27 at 14:10






What are you trying to accomplish with get()? $endpoints should already have what you need.

– aynber
Mar 27 at 14:10














Is "is_ondemand" from User? If yes, you could try auth()->user()->where('is_ondemand', true)->endpoints()->get()

– JoaoGRRR
Mar 27 at 14:12





Is "is_ondemand" from User? If yes, you could try auth()->user()->where('is_ondemand', true)->endpoints()->get()

– JoaoGRRR
Mar 27 at 14:12













@JoaoGRRR is_ondemand is from endpoints

– Trey Copeland
Mar 27 at 14:19





@JoaoGRRR is_ondemand is from endpoints

– Trey Copeland
Mar 27 at 14:19












0






active

oldest

votes










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55378519%2fusing-get-with-laravel-5%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55378519%2fusing-get-with-laravel-5%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript