1
0
Fork 0

initial api v1

main
A1Gard 1 year ago
parent 0e56e3915a
commit 91d5245627

@ -0,0 +1,25 @@
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Models\Cat;
use App\Models\Product;
use Illuminate\Http\Request;
use Xmen\StarterKit\Models\Post;
class ApiV1Controller extends Controller
{
//
public function index(){
$posts = Post::limit(10)->get();
$products = Product::limit(10)->get();
$categories = Cat::get();
return [
'posts' => $posts,
'products' => $products,
'categories' => $categories
];
}
}

@ -54,6 +54,8 @@ use Xmen\StarterKit\Models\StarterKit;
* @property-read int|null $accesses_count
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Product> $products
* @property-read int|null $products_count
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Access> $accesses
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Product> $products
* @mixin \Eloquent
*/
class User extends Authenticatable

@ -19,14 +19,20 @@ Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
return $request->user();
});
Route::get('/clear', function() {
Route::get('/clear', function () {
Artisan::call('cache:clear');
Artisan::call('config:clear');
Artisan::call('config:cache');
Artisan::call('view:clear');
Artisan::call('route:clear');
return "Cleared!";
});
Route::prefix('v1')->name('v1.')->group(
function () {
Route::get('index', [\App\Http\Controllers\Api\ApiV1Controller::class,'index'])->name('index');
});

Loading…
Cancel
Save