Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Server Development
Habbo Retros
Habbo Development
BrainCMS V2 [Arcturus EMU / Laravel 5.7 / Boostrap 4.3]
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="BrainCMS" data-source="post: 446003" data-attributes="member: 43173"><p>Add BrainCMS on GitHub</p><p><a href="https://git.io/fhNbN" target="_blank">https://git.io/fhNbN</a></p><p>[automerge]1551402688[/automerge]</p><p></p><p><strong><span style="font-size: 18px">Small edit plz tell me what you think about it, and what I can improve or change</span></strong></p><p></p><p><strong>MeController</strong></p><p>[CODE=php]<?php</p><p> </p><p> namespace App\Http\Controllers;</p><p></p><p> use Illuminate\Support\Facades\Auth;</p><p></p><p> class MeController extends Controller {</p><p></p><p> public function show() {</p><p> return view('pages.me.show', [</p><p> 'currency' => Auth::user()->currency()->get()</p><p> ]);</p><p> }</p><p> }[/CODE]</p><p></p><p><strong>User Model</strong></p><p>[CODE=php]<?php</p><p></p><p> namespace App;</p><p></p><p> use Illuminate\Notifications\Notifiable;</p><p> use Illuminate\Foundation\Auth\User as Authenticatable;</p><p></p><p> class User extends Authenticatable {</p><p></p><p> use Notifiable;</p><p></p><p> public $timestamps = false;</p><p></p><p> protected $fillable = [</p><p> 'email', 'password', 'username', 'ip_register', 'ip_current', 'motto', 'last_login', 'account_created', 'auth_ticket',</p><p> ];</p><p></p><p> protected $hidden = [</p><p> 'password', 'remember_token',</p><p> ];</p><p></p><p> protected $table = 'users_currency';</p><p></p><p> protected $primaryKey = 'user_id';</p><p></p><p> public function currency (){</p><p> return $this->hasMany(User::class, 'user_id')->select('amount','type');</p><p> }</p><p> }[/CODE]</p><p><strong>Me Blade</strong></p><p>[CODE=php]@extends('layouts.pages')</p><p></p><p>@section('title', 'Me')</p><p></p><p>@section('content')</p><p> <div class="row"></p><p> <div class="col-md-12"></p><p> <div class="menu-user"></p><p> Credits:{{ Auth::user()->credits }} <br></p><p> Duckets:</p><p> @foreach ($currency->where("type", "5") as $object)</p><p> {{ $object->amount }}</p><p> @endforeach</p><p> <br></p><p> Diamonds:</p><p> @foreach ($currency->where("type", "0") as $object)</p><p> {{ $object->amount }}</p><p> @endforeach</p><p> </div></p><p> </div></p><p></div></p><p>@endsection[/CODE]</p><p>[automerge]1551730771[/automerge]</p><p>Edits tnx to [USER=37998]@LeChris[/USER] </p><p></p><p>Clean up code + add currency model back</p><p>Update main HTTP structure</p><p>Remove useless files + add migrations + update README</p><p><strong></strong></p><p><strong>Users_currency</strong></p><p></p><p>[CODE=php]<?php</p><p>namespace App\Models\Player;</p><p>use Illuminate\Database\Eloquent\Model;</p><p>class Currency extends Model</p><p>{</p><p> protected $table = 'users_currency';</p><p> public $timestamps = false;</p><p> protected $fillable = [];</p><p>}[/CODE]</p><p></p><p><strong>Me Controller</strong></p><p></p><p>[CODE=php]<?php</p><p>namespace App\Http\Controllers\Home;</p><p>use Auth;</p><p>use App\Http\Controllers\Controller;</p><p>class Me extends Controller</p><p>{</p><p> public function render ()</p><p> {</p><p> return view('pages.user.home.me', [</p><p> 'currency' => Auth::user()->currency</p><p> ]);</p><p> }</p><p>}[/CODE]</p></blockquote><p></p>
[QUOTE="BrainCMS, post: 446003, member: 43173"] Add BrainCMS on GitHub [URL]https://git.io/fhNbN[/URL] [automerge]1551402688[/automerge] [B][SIZE=5]Small edit plz tell me what you think about it, and what I can improve or change[/SIZE][/B] [B]MeController[/B] [CODE=php]<?php namespace App\Http\Controllers; use Illuminate\Support\Facades\Auth; class MeController extends Controller { public function show() { return view('pages.me.show', [ 'currency' => Auth::user()->currency()->get() ]); } }[/CODE] [B]User Model[/B] [CODE=php]<?php namespace App; use Illuminate\Notifications\Notifiable; use Illuminate\Foundation\Auth\User as Authenticatable; class User extends Authenticatable { use Notifiable; public $timestamps = false; protected $fillable = [ 'email', 'password', 'username', 'ip_register', 'ip_current', 'motto', 'last_login', 'account_created', 'auth_ticket', ]; protected $hidden = [ 'password', 'remember_token', ]; protected $table = 'users_currency'; protected $primaryKey = 'user_id'; public function currency (){ return $this->hasMany(User::class, 'user_id')->select('amount','type'); } }[/CODE] [B]Me Blade[/B] [CODE=php]@extends('layouts.pages') @section('title', 'Me') @section('content') <div class="row"> <div class="col-md-12"> <div class="menu-user"> Credits:{{ Auth::user()->credits }} <br> Duckets: @foreach ($currency->where("type", "5") as $object) {{ $object->amount }} @endforeach <br> Diamonds: @foreach ($currency->where("type", "0") as $object) {{ $object->amount }} @endforeach </div> </div> </div> @endsection[/CODE] [automerge]1551730771[/automerge] Edits tnx to [USER=37998]@LeChris[/USER] Clean up code + add currency model back Update main HTTP structure Remove useless files + add migrations + update README [B] Users_currency[/B] [CODE=php]<?php namespace App\Models\Player; use Illuminate\Database\Eloquent\Model; class Currency extends Model { protected $table = 'users_currency'; public $timestamps = false; protected $fillable = []; }[/CODE] [B]Me Controller[/B] [CODE=php]<?php namespace App\Http\Controllers\Home; use Auth; use App\Http\Controllers\Controller; class Me extends Controller { public function render () { return view('pages.user.home.me', [ 'currency' => Auth::user()->currency ]); } }[/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Server Development
Habbo Retros
Habbo Development
BrainCMS V2 [Arcturus EMU / Laravel 5.7 / Boostrap 4.3]
Top