@ -0,0 +1,18 @@ |
||||
root = true |
||||
|
||||
[*] |
||||
charset = utf-8 |
||||
end_of_line = lf |
||||
indent_size = 4 |
||||
indent_style = space |
||||
insert_final_newline = true |
||||
trim_trailing_whitespace = true |
||||
|
||||
[*.md] |
||||
trim_trailing_whitespace = false |
||||
|
||||
[*.{yml,yaml}] |
||||
indent_size = 2 |
||||
|
||||
[docker-compose.yml] |
||||
indent_size = 4 |
@ -0,0 +1,47 @@ |
||||
<?php |
||||
|
||||
namespace App\Http\Controllers; |
||||
|
||||
use Illuminate\Http\Request; |
||||
use App\Models\Album; |
||||
use Illuminate\Support\Facades\Validator; |
||||
|
||||
class AlbumController extends Controller |
||||
{ |
||||
public function index(Request $request) |
||||
{ |
||||
$albums = Album::paginate(15); |
||||
if (count($albums) > $request->page) return response($albums[$request->page]); |
||||
return response(["message" => "Page not found"], 404); |
||||
} |
||||
|
||||
public function show(Request $request) |
||||
{ |
||||
$album = Album::find($request->id); |
||||
if ($album) return response($album); |
||||
return response(["message" => "Album not found"], 404); |
||||
} |
||||
|
||||
public function store(Request $request) |
||||
{ |
||||
$validator = Validator::make($request->all(), ["name" => "required"]); |
||||
if ($validator->fails()) return response($validator->messages(), 400); |
||||
response(Album::create($request->all())); |
||||
} |
||||
|
||||
public function update(Request $request) |
||||
{ |
||||
$album = Album::find($request->id); |
||||
if (!$album) return response(["message" => "Album not found"], 404); |
||||
$album->update($request->all()); |
||||
return response($album); |
||||
} |
||||
|
||||
public function destroy(Request $request) |
||||
{ |
||||
$album = Album::find($request->id); |
||||
if (!$album) return response(["message" => "Album not found"], 404); |
||||
$album->destroy(); |
||||
return response([]); |
||||
} |
||||
} |
@ -0,0 +1,47 @@ |
||||
<?php |
||||
|
||||
namespace App\Http\Controllers; |
||||
|
||||
use Illuminate\Http\Request; |
||||
use App\Models\Article; |
||||
use Illuminate\Support\Facades\Validator; |
||||
|
||||
class ArticleController extends Controller |
||||
{ |
||||
public function index(Request $request) |
||||
{ |
||||
$articles = Article::paginate(15); |
||||
if (count($articles) > $request->page) return response($articles[$request->page]); |
||||
return response(["message" => "Page not found"], 404); |
||||
} |
||||
|
||||
public function show(Request $request) |
||||
{ |
||||
$article = Article::find($request->id); |
||||
if ($article) return response($article); |
||||
return response(["message" => "Article not found"], 404); |
||||
} |
||||
|
||||
public function store(Request $request) |
||||
{ |
||||
$validator = Validator::make($request->all(), ["name" => "required"]); |
||||
if ($validator->fails()) return response($validator->messages(), 400); |
||||
response(Article::create($request->all())); |
||||
} |
||||
|
||||
public function update(Request $request) |
||||
{ |
||||
$article = Article::find($request->id); |
||||
if (!$article) return response(["message" => "Article not found"], 404); |
||||
$article->update($request->all()); |
||||
return response($article); |
||||
} |
||||
|
||||
public function destroy(Request $request) |
||||
{ |
||||
$article = Article::find($request->id); |
||||
if (!$article) return response(["message" => "Article not found"], 404); |
||||
$article->destroy(); |
||||
return response([]); |
||||
} |
||||
} |
@ -0,0 +1,10 @@ |
||||
<?php |
||||
|
||||
namespace App\Http\Controllers; |
||||
|
||||
use Illuminate\Http\Request; |
||||
|
||||
class AuthController extends Controller |
||||
{ |
||||
// |
||||
} |
@ -0,0 +1,45 @@ |
||||
<?php |
||||
|
||||
namespace App\Http\Controllers; |
||||
|
||||
use Illuminate\Http\Request; |
||||
use App\Models\Categorie; |
||||
use Illuminate\Support\Facades\Validator; |
||||
|
||||
class CategorieController extends Controller |
||||
{ |
||||
public function index(Request $request) |
||||
{ |
||||
return response(Categorie::all()); |
||||
} |
||||
|
||||
public function show(Request $request) |
||||
{ |
||||
$categorie = Categorie::find($request->id); |
||||
if ($categorie) return response($categorie); |
||||
return response(["message" => "Categorie not found"], 404); |
||||
} |
||||
|
||||
public function store(Request $request) |
||||
{ |
||||
$validator = Validator::make($request->all(), ["name" => "required"]); |
||||
if ($validator->fails()) return response($validator->messages(), 400); |
||||
response(Categorie::create($request->all())); |
||||
} |
||||
|
||||
public function update(Request $request) |
||||
{ |
||||
$categorie = Categorie::find($request->id); |
||||
if (!$categorie) return response(["message" => "Categorie not found"], 404); |
||||
$categorie->update($request->all()); |
||||
return response($categorie); |
||||
} |
||||
|
||||
public function destroy(Request $request) |
||||
{ |
||||
$categorie = Categorie::find($request->id); |
||||
if (!$categorie) return response(["message" => "Categorie not found"], 404); |
||||
$categorie->destroy(); |
||||
return response([]); |
||||
} |
||||
} |
@ -0,0 +1,31 @@ |
||||
<?php |
||||
|
||||
namespace App\Http\Controllers; |
||||
|
||||
use Illuminate\Http\Request; |
||||
use App\Models\Image; |
||||
use Illuminate\Support\Facades\Validator; |
||||
use Illuminate\Support\Facades\Storage; |
||||
|
||||
class ImageController extends Controller |
||||
{ |
||||
public function store(Request $request) |
||||
{ |
||||
$validator = Validator::make($request->all(), ["image" => "required"]); |
||||
if ($validator->fails()) return response($validator->messages(), 400); |
||||
$path = $request->file("image")->hashName(); |
||||
$request->file('image')->store("public/images"); |
||||
return response(Image::create([ |
||||
"url" => $path |
||||
])); |
||||
} |
||||
|
||||
public function destroy(Request $request) |
||||
{ |
||||
$image = Image::find($request->id); |
||||
if (!$image) return response(["message" => "Image not found"], 404); |
||||
Storage::disk('local')->delete("public/images/". $image->url); |
||||
$image->destroy(); |
||||
return response([]); |
||||
} |
||||
} |
@ -0,0 +1,47 @@ |
||||
<?php |
||||
|
||||
namespace App\Http\Controllers; |
||||
|
||||
use Illuminate\Http\Request; |
||||
use App\Models\Info; |
||||
use Illuminate\Support\Facades\Validator; |
||||
|
||||
class InfoController extends Controller |
||||
{ |
||||
public function index(Request $request) |
||||
{ |
||||
$infos = Info::paginate(15); |
||||
if (count($infos) > $request->page) return response($infos[$request->page]); |
||||
return response(["message" => "Page not found"], 404); |
||||
} |
||||
|
||||
public function show(Request $request) |
||||
{ |
||||
$info = Info::find($request->id); |
||||
if ($info) return response($info); |
||||
return response(["message" => "Info not found"], 404); |
||||
} |
||||
|
||||
public function store(Request $request) |
||||
{ |
||||
$validator = Validator::make($request->all(), ["name" => "required"]); |
||||
if ($validator->fails()) return response($validator->messages(), 400); |
||||
response(Info::create($request->all())); |
||||
} |
||||
|
||||
public function update(Request $request) |
||||
{ |
||||
$info = Info::find($request->id); |
||||
if (!$info) return response(["message" => "Info not found"], 404); |
||||
$info->update($request->all()); |
||||
return response($info); |
||||
} |
||||
|
||||
public function destroy(Request $request) |
||||
{ |
||||
$info = Info::find($request->id); |
||||
if (!$info) return response(["message" => "Info not found"], 404); |
||||
$info->destroy(); |
||||
return response([]); |
||||
} |
||||
} |
@ -0,0 +1,47 @@ |
||||
<?php |
||||
|
||||
namespace App\Http\Controllers; |
||||
|
||||
use Illuminate\Http\Request; |
||||
use App\Models\User; |
||||
use Illuminate\Support\Facades\Validator; |
||||
|
||||
class UserController extends Controller |
||||
{ |
||||
public function index(Request $request) |
||||
{ |
||||
$users = User::paginate(15); |
||||
if (count($users) > $request->page) return response($users[$request->page]); |
||||
return response(["message" => "Page not found"], 404); |
||||
} |
||||
|
||||
public function show(Request $request) |
||||
{ |
||||
$user = User::find($request->id); |
||||
if ($user) return response($user); |
||||
return response(["message" => "User not found"], 404); |
||||
} |
||||
|
||||
public function store(Request $request) |
||||
{ |
||||
$validator = Validator::make($request->all(), ["name" => "required"]); |
||||
if ($validator->fails()) return response($validator->messages(), 400); |
||||
response(User::create($request->all())); |
||||
} |
||||
|
||||
public function update(Request $request) |
||||
{ |
||||
$user = User::find($request->id); |
||||
if (!$user) return response(["message" => "User not found"], 404); |
||||
$user->update($request->all()); |
||||
return response($user); |
||||
} |
||||
|
||||
public function destroy(Request $request) |
||||
{ |
||||
$user = User::find($request->id); |
||||
if (!$user) return response(["message" => "User not found"], 404); |
||||
$user->destroy(); |
||||
return response([]); |
||||
} |
||||
} |
@ -0,0 +1,30 @@ |
||||
<?php |
||||
|
||||
namespace App\Models; |
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory; |
||||
use Illuminate\Database\Eloquent\Model; |
||||
|
||||
class Album extends Model |
||||
{ |
||||
use HasFactory; |
||||
|
||||
protected $fillable = [ |
||||
"name", |
||||
"description", |
||||
"created_at", |
||||
"updated_at" |
||||
]; |
||||
|
||||
public function articles() |
||||
{ |
||||
return $this->hasMany(Article::class); |
||||
} |
||||
|
||||
public function images() |
||||
{ |
||||
$images = []; |
||||
foreach($this->articles as $article) $images = array_merge($images, $article->images); |
||||
return $images; |
||||
} |
||||
} |
@ -0,0 +1,36 @@ |
||||
<?php |
||||
|
||||
namespace App\Models; |
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory; |
||||
use Illuminate\Database\Eloquent\Model; |
||||
|
||||
class Article extends Model |
||||
{ |
||||
use HasFactory; |
||||
|
||||
protected $fillable = [ |
||||
"title", |
||||
"description", |
||||
"content", |
||||
"user_id", |
||||
"album_id", |
||||
"created_at", |
||||
"updated_at" |
||||
]; |
||||
|
||||
public function album() |
||||
{ |
||||
return $this->belongsTo(Album::class); |
||||
} |
||||
|
||||
public function user() |
||||
{ |
||||
return $this->belongsTo(User::class); |
||||
} |
||||
|
||||
public function images() |
||||
{ |
||||
return $this->belongsToMany(Image::class, "images_articles"); |
||||
} |
||||
} |
@ -0,0 +1,22 @@ |
||||
<?php |
||||
|
||||
namespace App\Models; |
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory; |
||||
use Illuminate\Database\Eloquent\Model; |
||||
|
||||
class Categorie extends Model |
||||
{ |
||||
use HasFactory; |
||||
|
||||
protected $fillable = [ |
||||
"name", |
||||
"created_at", |
||||
"updated_at" |
||||
]; |
||||
|
||||
public function infos() |
||||
{ |
||||
return $this->hasMany(Info::class); |
||||
} |
||||
} |
@ -0,0 +1,17 @@ |
||||
<?php |
||||
|
||||
namespace App\Models; |
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory; |
||||
use Illuminate\Database\Eloquent\Model; |
||||
|
||||
class Image extends Model |
||||
{ |
||||
use HasFactory; |
||||
|
||||
protected $fillable = [ |
||||
"url", |
||||
"created_at", |
||||
"updated_at" |
||||
]; |
||||
} |
@ -0,0 +1,30 @@ |
||||
<?php |
||||
|
||||
namespace App\Models; |
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory; |
||||
use Illuminate\Database\Eloquent\Model; |
||||
|
||||
class Info extends Model |
||||
{ |
||||
use HasFactory; |
||||
|
||||
protected $fillable = [ |
||||
"title", |
||||
"content", |
||||
"categorie_id", |
||||
"user_id", |
||||
"created_at", |
||||
"updated_at" |
||||
]; |
||||
|
||||
public function user() |
||||
{ |
||||
return $this->belongsTo(User::class); |
||||
} |
||||
|
||||
public function categorie() |
||||
{ |
||||
return $this->belongsTo(Categorie::class); |
||||
} |
||||
} |
@ -1,26 +0,0 @@ |
||||
<?php |
||||
|
||||
namespace App\View\Components; |
||||
|
||||
use Closure; |
||||
use Illuminate\Contracts\View\View; |
||||
use Illuminate\View\Component; |
||||
|
||||
class layout extends Component |
||||
{ |
||||
/** |
||||
* Create a new component instance. |
||||
*/ |
||||
public function __construct() |
||||
{ |
||||
// |
||||
} |
||||
|
||||
/** |
||||
* Get the view / contents that represent the component. |
||||
*/ |
||||
public function render(): View|Closure|string |
||||
{ |
||||
return view('components.layout'); |
||||
} |
||||
} |
@ -1,83 +0,0 @@ |
||||
<?php |
||||
|
||||
use Laravel\Sanctum\Sanctum; |
||||
|
||||
return [ |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Stateful Domains |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Requests from the following domains / hosts will receive stateful API |
||||
| authentication cookies. Typically, these should include your local |
||||
| and production domains which access your API via a frontend SPA. |
||||
| |
||||
*/ |
||||
|
||||
'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf( |
||||
'%s%s', |
||||
'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1', |
||||
Sanctum::currentApplicationUrlWithPort() |
||||
))), |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Sanctum Guards |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| This array contains the authentication guards that will be checked when |
||||
| Sanctum is trying to authenticate a request. If none of these guards |
||||
| are able to authenticate the request, Sanctum will use the bearer |
||||
| token that's present on an incoming request for authentication. |
||||
| |
||||
*/ |
||||
|
||||
'guard' => ['web'], |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Expiration Minutes |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| This value controls the number of minutes until an issued token will be |
||||
| considered expired. This will override any values set in the token's |
||||
| "expires_at" attribute, but first-party sessions are not affected. |
||||
| |
||||
*/ |
||||
|
||||
'expiration' => null, |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Token Prefix |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| Sanctum can prefix new tokens in order to take advantage of numerous |
||||
| security scanning initiatives maintained by open source platforms |
||||
| that notify developers if they commit tokens into repositories. |
||||
| |
||||
| See: https://docs.github.com/en/code-security/secret-scanning/about-secret-scanning |
||||
| |
||||
*/ |
||||
|
||||
'token_prefix' => env('SANCTUM_TOKEN_PREFIX', ''), |
||||
|
||||
/* |
||||
|-------------------------------------------------------------------------- |
||||
| Sanctum Middleware |
||||
|-------------------------------------------------------------------------- |
||||
| |
||||
| When authenticating your first-party SPA with Sanctum you may need to |
||||
| customize some of the middleware Sanctum uses while processing the |
||||
| request. You may change the middleware listed below as required. |
||||
| |
||||
*/ |
||||
|
||||
'middleware' => [ |
||||
'authenticate_session' => Laravel\Sanctum\Http\Middleware\AuthenticateSession::class, |
||||
'encrypt_cookies' => Illuminate\Cookie\Middleware\EncryptCookies::class, |
||||
'validate_csrf_token' => Illuminate\Foundation\Http\Middleware\ValidateCsrfToken::class, |
||||
], |
||||
|
||||
]; |
@ -1,33 +0,0 @@ |
||||
<?php |
||||
|
||||
use Illuminate\Database\Migrations\Migration; |
||||
use Illuminate\Database\Schema\Blueprint; |
||||
use Illuminate\Support\Facades\Schema; |
||||
|
||||
return new class extends Migration |
||||
{ |
||||
/** |
||||
* Run the migrations. |
||||
*/ |
||||
public function up(): void |
||||
{ |
||||
Schema::create('personal_access_tokens', function (Blueprint $table) { |
||||
$table->id(); |
||||
$table->morphs('tokenable'); |
||||
$table->string('name'); |
||||
$table->string('token', 64)->unique(); |
||||
$table->text('abilities')->nullable(); |
||||
$table->timestamp('last_used_at')->nullable(); |
||||
$table->timestamp('expires_at')->nullable(); |
||||
$table->timestamps(); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Reverse the migrations. |
||||
*/ |
||||
public function down(): void |
||||
{ |
||||
Schema::dropIfExists('personal_access_tokens'); |
||||
} |
||||
}; |
@ -0,0 +1,35 @@ |
||||
<?php |
||||
|
||||
use Illuminate\Database\Migrations\Migration; |
||||
use Illuminate\Database\Schema\Blueprint; |
||||
use Illuminate\Support\Facades\Schema; |
||||
use Illuminate\Support\Facades\DB; |
||||
|
||||
return new class extends Migration |
||||
{ |
||||
/** |
||||
* Run the migrations. |
||||
*/ |
||||
public function up(): void |
||||
{ |
||||
Schema::create('albums', function (Blueprint $table) { |
||||
$table->id(); |
||||
$table->string("name", 255); |
||||
$table->string("description", 800)->nullable(); |
||||
$table->timestamps(); |
||||
}); |
||||
|
||||
DB::table("albums")->insert([ |
||||
"name" => "Autres", |
||||
"description" => "Tout les articles sans album." |
||||
]); |
||||
} |
||||
|
||||
/** |
||||
* Reverse the migrations. |
||||
*/ |
||||
public function down(): void |
||||
{ |
||||
Schema::dropIfExists('albums'); |
||||
} |
||||
}; |
@ -0,0 +1,33 @@ |
||||
<?php |
||||
|
||||
use Illuminate\Database\Migrations\Migration; |
||||
use Illuminate\Database\Schema\Blueprint; |
||||
use Illuminate\Support\Facades\Schema; |
||||
use Illuminate\Support\Facades\DB; |
||||
|
||||
return new class extends Migration |
||||
{ |
||||
/** |
||||
* Run the migrations. |
||||
*/ |
||||
public function up(): void |
||||
{ |
||||
Schema::create('images', function (Blueprint $table) { |
||||
$table->id(); |
||||
$table->string("url", 255)->unique(); |
||||
$table->timestamps(); |
||||
}); |
||||
|
||||
DB::table("images")->insert([ |
||||
"url" => "default-pic.svg" |
||||
]); |
||||
} |
||||
|
||||
/** |
||||
* Reverse the migrations. |
||||
*/ |
||||
public function down(): void |
||||
{ |
||||
Schema::dropIfExists('images'); |
||||
} |
||||
}; |
@ -0,0 +1,34 @@ |
||||
<?php |
||||
|
||||
use Illuminate\Database\Migrations\Migration; |
||||
use Illuminate\Database\Schema\Blueprint; |
||||
use Illuminate\Support\Facades\Schema; |
||||
|
||||
return new class extends Migration |
||||
{ |
||||
/** |
||||
* Run the migrations. |
||||
*/ |
||||
public function up(): void |
||||
{ |
||||
Schema::create('articles', function (Blueprint $table) { |
||||
$table->id(); |
||||
$table->string("title", 255); |
||||
$table->string("description", 800); |
||||
$table->longText("content")->nullable(); |
||||
$table->unsignedBigInteger("user_id"); |
||||
$table->unsignedBigInteger("album_id")->default(0); |
||||
$table->timestamps(); |
||||
$table->foreign("user_id")->references("id")->on("users"); |
||||
$table->foreign("album_id")->references("id")->on("albums"); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Reverse the migrations. |
||||
*/ |
||||
public function down(): void |
||||
{ |
||||
Schema::dropIfExists('articles'); |
||||
} |
||||
}; |
@ -0,0 +1,33 @@ |
||||
<?php |
||||
|
||||
use Illuminate\Database\Migrations\Migration; |
||||
use Illuminate\Database\Schema\Blueprint; |
||||
use Illuminate\Support\Facades\Schema; |
||||
use Illuminate\Support\Facades\DB; |
||||
|
||||
return new class extends Migration |
||||
{ |
||||
/** |
||||
* Run the migrations. |
||||
*/ |
||||
public function up(): void |
||||
{ |
||||
Schema::create('categories', function (Blueprint $table) { |
||||
$table->id(); |
||||
$table->string("name", 255)->unique(); |
||||
$table->timestamps(); |
||||
}); |
||||
|
||||
DB::table("categories")->insert([ |
||||
"name" => "Autres" |
||||
]); |
||||
} |
||||
|
||||
/** |
||||
* Reverse the migrations. |
||||
*/ |
||||
public function down(): void |
||||
{ |
||||
Schema::dropIfExists('categories'); |
||||
} |
||||
}; |
@ -0,0 +1,33 @@ |
||||
<?php |
||||
|
||||
use Illuminate\Database\Migrations\Migration; |
||||
use Illuminate\Database\Schema\Blueprint; |
||||
use Illuminate\Support\Facades\Schema; |
||||
|
||||
return new class extends Migration |
||||
{ |
||||
/** |
||||
* Run the migrations. |
||||
*/ |
||||
public function up(): void |
||||
{ |
||||
Schema::create('infos', function (Blueprint $table) { |
||||
$table->id(); |
||||
$table->string("title", 255); |
||||
$table->longText("content"); |
||||
$table->unsignedBigInteger("categorie_id"); |
||||
$table->unsignedBigInteger("user_id"); |
||||
$table->timestamps(); |
||||
$table->foreign("categorie_id")->references("id")->on("categories"); |
||||
$table->foreign("user_id")->references("id")->on("users"); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Reverse the migrations. |
||||
*/ |
||||
public function down(): void |
||||
{ |
||||
Schema::dropIfExists('infos'); |
||||
} |
||||
}; |
@ -0,0 +1,29 @@ |
||||
<?php |
||||
|
||||
use Illuminate\Database\Migrations\Migration; |
||||
use Illuminate\Database\Schema\Blueprint; |
||||
use Illuminate\Support\Facades\Schema; |
||||
|
||||
return new class extends Migration |
||||
{ |
||||
/** |
||||
* Run the migrations. |
||||
*/ |
||||
public function up(): void |
||||
{ |
||||
Schema::create('images_articles', function (Blueprint $table) { |
||||
$table->id(); |
||||
$table->unsignedBigInteger("image_id"); |
||||
$table->unsignedBigInteger("article_id"); |
||||
$table->timestamps(); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* Reverse the migrations. |
||||
*/ |
||||
public function down(): void |
||||
{ |
||||
Schema::dropIfExists('images_articles'); |
||||
} |
||||
}; |
@ -0,0 +1,24 @@ |
||||
<?php |
||||
|
||||
namespace Database\Seeders; |
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents; |
||||
use Illuminate\Database\Seeder; |
||||
use App\Models\Album; |
||||
|
||||
class AlbumsSeeder extends Seeder |
||||
{ |
||||
/** |
||||
* Run the database seeds. |
||||
*/ |
||||
public function run(): void |
||||
{ |
||||
$faker = \Faker\Factory::create(); |
||||
for ($i = 0; $i < 10; $i++) |
||||
Album::create([ |
||||
"name" => $faker->title(), |
||||
"description" => $faker->paragraph(), |
||||
]); |
||||
|
||||
} |
||||
} |
@ -0,0 +1,17 @@ |
||||
<?php |
||||
|
||||
namespace Database\Seeders; |
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents; |
||||
use Illuminate\Database\Seeder; |
||||
|
||||
class ArticlesSeeder extends Seeder |
||||
{ |
||||
/** |
||||
* Run the database seeds. |
||||
*/ |
||||
public function run(): void |
||||
{ |
||||
// |
||||
} |
||||
} |
@ -0,0 +1,22 @@ |
||||
<?php |
||||
|
||||
namespace Database\Seeders; |
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents; |
||||
use Illuminate\Database\Seeder; |
||||
use App\Models\Categorie; |
||||
|
||||
class CategoriesSeeder extends Seeder |
||||
{ |
||||
/** |
||||
* Run the database seeds. |
||||
*/ |
||||
public function run(): void |
||||
{ |
||||
$faker = \Faker\Factory::create(); |
||||
for ($i = 0; $i < 8; $i++) |
||||
Categorie::create([ |
||||
"name" => $faker->title(), |
||||
]); |
||||
} |
||||
} |
@ -0,0 +1,17 @@ |
||||
<?php |
||||
|
||||
namespace Database\Seeders; |
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents; |
||||
use Illuminate\Database\Seeder; |
||||
|
||||
class InfosSeeder extends Seeder |
||||
{ |
||||
/** |
||||
* Run the database seeds. |
||||
*/ |
||||
public function run(): void |
||||
{ |
||||
// |
||||
} |
||||
} |
@ -0,0 +1,28 @@ |
||||
<?php |
||||
|
||||
namespace Database\Seeders; |
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents; |
||||
use Illuminate\Database\Seeder; |
||||
use App\Models\User; |
||||
use Carbon\Carbon; |
||||
|
||||
class UsersSeeder extends Seeder |
||||
{ |
||||
/** |
||||
* Run the database seeds. |
||||
*/ |
||||
public function run(): void |
||||
{ |
||||
// $faker = \Faker\Factory::create(); |
||||
// for ($i = 0; $i < 15; $i++) |
||||
// User::create([ |
||||
// "name" => $faker->firstName(), |
||||
// "lastname" => $faker->lastName(), |
||||
// "totem" => $faker->company(), |
||||
// "email" => $faker->email(), |
||||
// "phone" => $faker->e164PhoneNumber(), |
||||
// "email_verified_at" => Carbon::now(), |
||||
// ]); |
||||
} |
||||
} |
@ -1,6 +0,0 @@ |
||||
export default { |
||||
plugins: { |
||||
tailwindcss: {}, |
||||
autoprefixer: {}, |
||||
}, |
||||
} |
Before Width: | Height: | Size: 118 KiB After Width: | Height: | Size: 0 B |
Before Width: | Height: | Size: 516 B |
Before Width: | Height: | Size: 915 B |
Before Width: | Height: | Size: 823 B |
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
@ -1,54 +0,0 @@ |
||||
# Baslac.ch |
||||
|
||||
# Pages |
||||
* Article |
||||
* lister tout les article |
||||
* montrer un article en detail |
||||
* creer un aricle (Utilisateur) |
||||
* Page info |
||||
* montrer une page info en detail |
||||
* creer une page info (Utilisateur) |
||||
* les page info seront lister dans le menu du site par categorie |
||||
* Contact |
||||
* Lister les utilisateur qui peuvent etre contacté et montre les info de contact |
||||
|
||||
# Fonctionnalité |
||||
* Un utilisateur par chef. |
||||
* Les cutilisateur sont créer uniquement pour les chef. |
||||
* Les article sont postée automatiquement sur les autre réseau. |
||||
* Affiché le programme au formats pdf. |
||||
* Possibilité pour les parents de s'inscrire a une news letter |
||||
* Afficher les informations du groupe |
||||
* Les utilisateur peuvent faire des articles. |
||||
* Les contenu des article peuvent est ecrire dans le meme style que se document. |
||||
* Les utilisateur doivent recevoir un code pour pouvoir sign in, code qui peux etre produit par n'import quel utilisateur. |
||||
* Le premiere utilisateur sera groupe@baslac.ch et sera controller par l'administrateur du site. |
||||
# Donnée |
||||
obligatoire = * |
||||
|
||||
## Utilisateur |
||||
* Nom * |
||||
* Role |
||||
* Totem |
||||
* Photo de profil |
||||
* Email * |
||||
* Numero de telephone |
||||
* Contactable (Oui/Non) |
||||
* Mot de passe |
||||
|
||||
|
||||
## Article |
||||
* titre * |
||||
* description * |
||||
* photos * |
||||
* contenu |
||||
* date |
||||
* auteur(Utilisateur) * |
||||
|
||||
## page info |
||||
* nom de la page |
||||
* contenu |
||||
|
||||
## categorie |
||||
* nom de la categorie |
||||
* lien vers des pages infos |
@ -1,7 +0,0 @@ |
||||
@tailwind base; |
||||
@tailwind components; |
||||
@tailwind utilities; |
||||
|
||||
:root { |
||||
--menu-back-color:#681536ef; |
||||
} |
@ -1,21 +0,0 @@ |
||||
<!DOCTYPE html> |
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}" class="dark"> |
||||
<head> |
||||
<meta charset="UTF-8"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||
@if($title) <title>Scouts Baslac - {{ $title }}</title> |
||||
@else <title>Scouts Baslac</title> |
||||
@endif |
||||
|
||||
@vite('resources/css/app.css') |
||||
|
||||
@if($csslinks) {{ $csslinks }} |
||||
@endif |
||||
@if($jslinks) {{ $jslinks }} |
||||
@endif |
||||
</head> |
||||
<body class="w-full h-screen flex laptop:flex-row flex-col dark:bg-black dark:text-white"> |
||||
@include('prefab.menu-list') |
||||
{{ $slot }} |
||||
</body> |
||||
</html> |
@ -1,4 +0,0 @@ |
||||
<a href="{{ $href }}" class="flex laptop:w-1/2 my-5 mx-10"> |
||||
<img class="laptop:w-[20px] dark:brightness-0 dark:invert" src="/img/{{ $icon }}.svg"> |
||||
<p class="text-xl ml-2">{{ $name }}</p> |
||||
</a> |
@ -1,25 +0,0 @@ |
||||
<nav class="laptop:h-screen laptop:w-[200px] w-full h-[100px] laptop:border-r border-b border-black dark:border-white"> |
||||
<div class="w-full flex h-full laptop:flex-col laptop:items-center"> |
||||
<div class="laptop:w-4/5 py-2 mx-10"> |
||||
<img class="laptop:h-[100px]" src="/img/baslac.svg"> |
||||
</div> |
||||
<div class="flex laptop:w-full h-full |
||||
laptop:border-t laptop:border-gray-400 laptop:flex-col items-center"> |
||||
@include("prefab.item-list", [ |
||||
"name" => "Infos", |
||||
"href" => "#", |
||||
"icon" => "info_icon" |
||||
]) |
||||
@include("prefab.item-list", [ |
||||
"name" => "Articles", |
||||
"href" => "#", |
||||
"icon" => "article_icon" |
||||
]) |
||||
@include("prefab.item-list", [ |
||||
"name" => "Contact", |
||||
"href" => "#", |
||||
"icon" => "contact_icon" |
||||
]) |
||||
</div> |
||||
</div> |
||||
</nav> |
@ -1,8 +0,0 @@ |
||||
<?php |
||||
|
||||
use Illuminate\Http\Request; |
||||
use Illuminate\Support\Facades\Route; |
||||
|
||||
Route::get('/user', function (Request $request) { |
||||
return $request->user(); |
||||
})->middleware('auth:sanctum'); |
@ -1,13 +1,45 @@ |
||||
<?php |
||||
|
||||
use Illuminate\Support\Facades\Route; |
||||
use App\Http\Controllers\AlbumController; |
||||
use App\Http\Controllers\ArticleController; |
||||
use App\Http\Controllers\CategorieController; |
||||
use App\Http\Controllers\ImageController; |
||||
use App\Http\Controllers\InfoController; |
||||
use App\Http\Controllers\UserController; |
||||
use App\Http\Controllers\AuthController; |
||||
|
||||
Route::get('/', function () { |
||||
return view('home'); |
||||
}); |
||||
Route::get('/', function () { return view('home'); }); |
||||
|
||||
Route::get('/home', function () { |
||||
return redirect('/'); |
||||
}); |
||||
Route::get("/albums", [AlbumController::class, "index"]); |
||||
Route::get("/albums/{id}", [AlbumController::class, "show"]); |
||||
Route::post("/albums", [AlbumController::class, "store"]); |
||||
Route::put("/albums/{id}", [AlbumController::class, "update"]); |
||||
Route::delete("/albums/{id}", [AlbumController::class, "destroy"]); |
||||
|
||||
Route::get("/article", [ArticleController::class, "index"]); |
||||
Route::get("/article/{id}", [ArticleController::class, "show"]); |
||||
Route::post("/article", [ArticleController::class, "store"]); |
||||
Route::put("/article/{id}", [ArticleController::class, "update"]); |
||||
Route::delete("/article/{id}", [ArticleController::class, "destroy"]); |
||||
|
||||
Route::get("/categories", [CategorieController::class, "index"]); |
||||
Route::get("/categories/{id}", [CategorieController::class, "show"]); |
||||
Route::post("/categories", [CategorieController::class, "store"]); |
||||
Route::put("/categories/{id}", [CategorieController::class, "update"]); |
||||
Route::delete("/categories/{id}", [CategorieController::class, "destroy"]); |
||||
|
||||
Route::get("/users", [UserController::class, "index"]); |
||||
Route::get("/users/{id}", [UserController::class, "show"]); |
||||
Route::post("/users", [UserController::class, "store"]); |
||||
Route::put("/users/{id}", [UserController::class, "update"]); |
||||
Route::delete("/users/{id}", [UserController::class, "destroy"]); |
||||
|
||||
Route::get("/infos", [InfoController::class, "index"]); |
||||
Route::get("/infos/{id}", [InfoController::class, "show"]); |
||||
Route::post("/infos", [InfoController::class, "store"]); |
||||
Route::put("/infos/{id}", [InfoController::class, "update"]); |
||||
Route::delete("/infos/{id}", [InfoController::class, "destroy"]); |
||||
|
||||
Route::post("/images", [ImageController::class, "store"]); |
||||
Route::delete("/images/{id}", [ImageController::class, "destroy"]); |
@ -1,3 +1,4 @@ |
||||
* |
||||
!private/ |
||||
!public/ |
||||
!.gitignore |
||||
|
@ -0,0 +1,2 @@ |
||||
* |
||||
!.gitignore |
@ -1,18 +0,0 @@ |
||||
/** @type {import('tailwindcss').Config} */ |
||||
export default { |
||||
darkMode: 'class', |
||||
content: [ |
||||
"./resources/**/*.blade.php", |
||||
"./resources/**/*.js", |
||||
"./resources/**/*.vue", |
||||
], |
||||
theme: { |
||||
screens: { |
||||
'tablet': '640px', |
||||
'laptop': '1280px', |
||||
'desktop': '1920px', |
||||
}, |
||||
extend: {}, |
||||
}, |
||||
plugins: [], |
||||
} |
@ -1,8 +0,0 @@ |
||||
# todo |
||||
* creer base du site laravel vue.js tailwind |
||||
* creer la base de donné et les migration |
||||
* creer les utilisateur |
||||
* creer les controller/API d'authentification |
||||
* creer les models des donnée du site |
||||
* creer les API de ces donnée |
||||
* creer les pages avec vue.js |