lundi 28 mai 2018

Laravel undefined variable (but it is sent)

My PostController:

    $posts = Post::orderBy('created_at', 'desc')
                 ->where([['status', 'PUBLISHED'],['post_type', 'PORTFOLIO']])
                 ->paginate(9);

    $partners = Post::orderBy('created_at', 'desc')
                 ->where([['status', 'PUBLISHED'],['post_type', 'PARTNERS']])
                 ->get();
 //   return view('landing.onepageindex', ['posts' => $posts], ['pages' => $pages], ['partners' => $partners]);
    return view(
             'landing.onepageindex',
             ['posts' => $posts],
             ['pages' => $pages],
             ['partners' => $partners]
         );

I'm trying to do a foreach for the partners var, but it says its undefined, what am I doing wrong here? I'm rather new to Laravel, but this thing just got me confused. Am I not allowed to create 2 vars that go for the same post (just different post types)?

Posts and Pages work as they should, partners doesn't.

Thanks in advance.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2IR81qv
via IFTTT

Convert mysql query to working with laravel

I have this mysql query which is working fine for me and now I decided to convert my project to laravel project so I want to convert mysql query to laravel query this is my query

    select c.username,
   max(case when c.attribute = 'Cleartext-Password' then c.value end) as password,
   max(case when c.attribute = 'Expiration' then c.value end) as expiration,
    max(case when c.attribute = 'ChilliSpot-Max-Total-Octets' then c.value end) as quta,
     max(case when c.attribute = 'Simultaneous-Use' then c.value end) as simul,
 max(case when c.attribute = 'Max-All-Session' then c.value end) as session,
   max(c.adsoyad) as realname, min(c.dtarih) as birthdate, min(c.telefon) as phone,min(c.tcno) as tc,max(c.email) as email,min(c.id) as id
 from radcheck c 
group by c.username

how can I do it 



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2LERcwm
via IFTTT

Adjust time format in Laravel?

This is my code:

 

The date shows up like this: May-23-2018

How can I modify the code so the date shows up like this: Posted on May 23, 2018



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2LyGkjE
via IFTTT

Laravel 5.5 fail when serve

5 project and after install Laravel and make php artisan serve it fails.

PHP Warning: require(/var/www/html/sidbrint/vendor/autoload.php): failed to open stream: No such file or directory in /var/www/html/sidbrint/artisan on line 18

PHP Fatal error: require(): Failed opening required '/var/www/html/sidbrint/vendor/autoload.php (include_path='.:/usr/share/php') in /var/www/html/sidbrint/artisan on line 18

I'm using an Ubuntu Server and I don't know hat to do.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2siWGnP
via IFTTT

Laravel 5 want to access auth user id in model

I want to access the currently logged In user ID in the model. So in the model, I have written the codes;

namespace App\Model;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;
use Auth;

and in the method under the model, I used this code: Auth::user()->id However, I receives the error:

Trying to get property of non-object



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2J9LRyZ
via IFTTT

Get collection with own data and secified vars from sub collection in eloquent

First of all, sorry when the question description does not describe my question very well but i have no idea how to form my question better in one line. Suggestions are welcome..

Background info

  • Laravel 5.6.x
  • I defined my objects as eloquent models
  • Using migrations to create the database

Background info about the application

I have an application where a Game object has a one-to-many relation with Player objects. The Game object contains all game details, the Player object contains all details of an individual player.

Players gets invited for a game and can accept of deny this. This info is saved in the player themselves as the player is unique per game.

Now i want to create an overview of all games. One of the things in the overview are the amount of accepted players, the invited players and their id's.

To get all games, i use $games = Game::all(); what gives me an array with all games (without players). I was able to add the players to the array by doing:

foreach ($game as $singleGame){
   $singleGame->players
}

After that my $games array contains all games with a subcollection per game with its players. This is almost what i need, but the subcollection contains to many details about the player, e.g. the hand cards the player has.

The question Is there a simple way to just add the invite_status and player_id value of each player to the game its sub-collection instead of all the players vars?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2IT8XGA
via IFTTT

Need to display the suggestion domain price from enom API based on the domain checking API using laravel 5.6

I need to display the domain suggestion price details based to check the domain availability.how to display the domain price based on the tld value.I have displayed the price if the domain is available but i have lot of confusion how to display the suggestion domain price list(This list is based on TLD Value)

DomainName Checking API URL [https://reseller.enom.com/interface.asp?command=check&sld=decksys&tld=com&uid=decksys&pw=Amy.th3ist4917&responsetype=xml&version=2&includeprice=1&includeproperties=1&includeeap=1]

Output of Domain Checking API

{"interface-response":
{"Domains":{"Domain":
{"Name":"decksys.com","RRPCode":"211","RRPText":"Domain not available","IsPremium":"False","IsPlatinum":"False","IsEAP":"False",
"Prices":"Currency":"","Registration":"9.98","Renewal":"9.98",
"Restore":"250.00","Transfer":"9.98",
"ExpectedCustomerSuppliedPrice":null},
"Properties": {"NativeSLD":"","MinRegYear":"1","MaxRegYear":"10",
"AbleToLock":"True","ExtAttributes":"False","Transferable":"True",
"AllowWPPS":"True","TrademarkStart":{"@UTC":"","@Epoch":""},
"TrademarkEnd":{"@UTC":"","@Epoch":""}},"EAP":null}},"Command":"CHECK",
"APIType":"API.NET","Language":"eng","ErrCount":"0","ResponseCount":"0",
"MinPeriod":"1","MaxPeriod":"10","Server":"sjl0vwapi09","Site":"eNom",
"IsLockable":null,"IsRealTimeTLD":null,"TimeDifference":"+0.00","ExecTime":
"0.284","Done":"true","TrackingKey":"ad405f45-e3b7-4299-a8ea- 
fe6a9b2149ad","RequestDateTime":"5/28/2018 2:47:48 AM","debug":null}}

Domain Suggestion API URL [http://reseller.enom.com/interface.asp?command=GETNAMESUGGESTIONS&uid=decksys&pw=Amy.th3ist4917&SearchTerm=deckwsys&ResponseType=XML]

Domain Suggestion API Output

{"DomainSuggestions":{"Domain": 
["DeckSys.builders","DeckSys.build","DeckSys.tech",
"Deck-Sys.builders","DeckSys.lighting","DeckSys.bio","DeckSys.cloud",
"DeckSys.software","DeckSys.global","DeckSys.build","DeckSys.cleaning",
"DeckSys.supply","DeckSys.technology","DeckSys.solutions","DeckSys.tools",
"DeckSys.engineer","Deck-Sys.tech","Deck-Sys.lighting","Deck-Sys.bio",
"Deck-Sys.cloud","Deck-Sys.software","Deck-Sys.global","Deck-Sys.cleaning",
"Deck-Sys.supply","Deck-Sys.technology","Deck-Sys.solutions",
"Deck-Sys.tools","DeckSys.engineer","DeckSy.builders","DeckSy.build",
"TrimSys.builders","DeckSy.tech","ArraySys.builders","AdornSys.builders",
"Deck-Sy.builders","MyDeckSys.builders","TrimSys.build","DeckSy.lighting",
"ArraySys.build","DeckSy.bio","TrimSys.tech","AdornSys.build","DeckSy.cloud"
,"DeckSy.software","ArraySys.tech","DeckSy.global","DeckSysTech.builders",
"Deck-Sy.build","MyDeckSys.build","DeckSy.cleaning"]},"DomainSuggestionCount
":"50","Command":"GETNAMESUGGESTIONS","APIType":"API.NET","Language":"eng",
"ErrCount":"0","ResponseCount":"0","MinPeriod":"1","MaxPeriod":"10","Server"
:"sjl0vwapi06","Site":"eNom","IsLockable":{},"IsRealTimeTLD":{},
"TimeDifference":"+0.00","ExecTime":"0.469","Done":"true","TrackingKey":
"7bd9d667-d3b8-4c7f-91e1-9634a229e4b2","RequestDateTime":"5\/28\/2018 
2:56:20 AM","debug":{}}

Domain TLD Pricing API URL [https://reseller.enom.com/interface.asp?command=PE_GETDOMAINPRICING&uid=decksys&pw=Amy.th3ist4917&responsetype=xml]

Please suggest any solution to display the suggestion domain price based to check the domain availability



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2ktZv1R
via IFTTT