diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 8c1e225..3b9a806 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -4,6 +4,7 @@ namespace App\Http\Controllers; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; +use App\Models\FeedPost; class HomeController extends Controller { @@ -33,7 +34,37 @@ class HomeController extends Controller public function home() { $friends = Auth::user()->getFriends($perPage = 3); + $posts = FeedPost::where(function ($query) { + $userFriends = Auth::user()->getFriends(); + $friendIds = array(); - return view('home')->with('friends', $friends); + foreach ($userFriends as $uF) { + array_push($friendIds, $uF->id); + } + + $query->whereIn('user_id', $friendIds) + ->orWhere('user_id', '=', Auth::id()); + })->orderBy('id', 'desc')->paginate(10); + + $data = [ + 'friends' => $friends, + 'posts' => $posts, + ]; + + return view('home')->with('data', $data); + } + + public function feed_post(Request $request) + { + $request->validate([ + 'status' => 'required|min:3|max:100' + ]); + + $post = new FeedPost; + $post->user_id = Auth::id(); + $post->status = $request->status; + $post->save(); + + return redirect()->back()->with('success', 'Posted!'); } } diff --git a/app/Models/FeedPost.php b/app/Models/FeedPost.php new file mode 100644 index 0000000..911b68c --- /dev/null +++ b/app/Models/FeedPost.php @@ -0,0 +1,30 @@ + + */ + protected $fillable = [ + 'user_id', + 'status', + ]; + + public function user() + { + return $this->belongsTo('App\Models\User'); + } +} diff --git a/app/Models/InviteKey.php b/app/Models/InviteKey.php index 6c12aeb..17ad144 100644 --- a/app/Models/InviteKey.php +++ b/app/Models/InviteKey.php @@ -9,6 +9,10 @@ class InviteKey extends Model { use HasFactory; + protected $table = 'invite_keys'; + public $primaryKey = 'id'; + public $timestamps = true; + /** * The attributes that are mass assignable. * diff --git a/app/Models/User.php b/app/Models/User.php index 2864537..e51a399 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -14,6 +14,10 @@ class User extends Authenticatable { use HasApiTokens, HasFactory, Notifiable, Friendable; + protected $table = 'users'; + public $primaryKey = 'id'; + public $timestamps = true; + /** * The attributes that are mass assignable. * @@ -56,4 +60,9 @@ class User extends Authenticatable return true; } } + + public function feedposts() + { + return $this->hasMany('App\Models\FeedPost'); + } } diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 3bd3c81..58b7fe4 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -56,8 +56,11 @@ class RouteServiceProvider extends ServiceProvider */ protected function configureRateLimiting() { - RateLimiter::for('api', function (Request $request) { + /*RateLimiter::for('api', function (Request $request) { return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip()); + });*/ + RateLimiter::for('feed_post', function (Request $request) { + return Limit::perMinute(1)->by(optional($request->user())->id); }); } } diff --git a/database/migrations/2022_07_14_021655_create_feed_posts_table.php b/database/migrations/2022_07_14_021655_create_feed_posts_table.php new file mode 100644 index 0000000..f207dc7 --- /dev/null +++ b/database/migrations/2022_07_14_021655_create_feed_posts_table.php @@ -0,0 +1,33 @@ +id(); + $table->integer('user_id'); + $table->string('status'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('feed_posts'); + } +} diff --git a/public/css/RobloxOld.css b/public/css/RobloxOld.css new file mode 100644 index 0000000..3068e6f --- /dev/null +++ b/public/css/RobloxOld.css @@ -0,0 +1,32 @@ +* +{ + font-size: 12px; + font-family: 'Comic Sans MS', Verdana, Arial, Helvetica, sans-serif; +} +H1 +{ + font-weight: bold; + font-size: larger; +} + +/* + FILE ARCHIVED ON 17:06:51 Feb 02, 2007 AND RETRIEVED FROM THE + INTERNET ARCHIVE ON 13:32:02 May 30, 2022. + JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE. + + ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C. + SECTION 108(a)(3)). +*/ +/* +playback timings (ms): + captures_list: 543.356 + exclusion.robots: 0.115 + exclusion.robots.policy: 0.106 + cdx.remote: 0.078 + esindex: 0.011 + LoadShardBlock: 514.942 (3) + PetaboxLoader3.datanode: 196.729 (4) + CDXLines.iter: 17.173 (3) + PetaboxLoader3.resolve: 383.648 (2) + load_resource: 175.393 +*/ \ No newline at end of file diff --git a/public/game/Help.aspx b/public/game/Help.aspx new file mode 100644 index 0000000..7cfd35b --- /dev/null +++ b/public/game/Help.aspx @@ -0,0 +1,88 @@ + +
+- - -
+
+ @foreach ($data['posts'] as $post)
+ "{{ $post->status }}"
+{{ $post->created_at->format('F d, Y H:i A') }}
+Your feed is empty.
+ @endifYou don't have any friends yet!
- @endif + @endif"I'm new to ARCHBLOX!"
+ @if (!empty($data['user']->feedposts->last()->status)) + "{{ $data['user']->feedposts->last()->status }}" + @else + "I'm new to ARCHBLOX!" + @endif
"I'm new to ARCHBLOX!"
+ @if (!request()->has('q')) + @if (!empty($user->feedposts->last()->status)) +"{{ $user->feedposts->last()->status }}"
+ @else +"I'm new to ARCHBLOX!"
+ @endif + @else + @if (!empty(App\Models\FeedPost::where('user_id', $user->id)->first()->status)) +"{{ App\Models\FeedPost::where('user_id', $user->id)->orderBy('id', 'desc')->first()->status }}"
+ @else +"I'm new to ARCHBLOX!"
+ @endif + @endif @if (Cache::has('is_online_' . $user->id)) Website @else - Offline - Last Online {{ Carbon\Carbon::parse($user->last_seen)->diffForHumans() }} + Offline - Last Online + {{ Carbon\Carbon::parse($user->last_seen)->diffForHumans() }} @endif