generated from IBEC-BOX/admin-kit-package-skeleton
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add filament resource, http api
- Loading branch information
Showing
19 changed files
with
631 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
database/migrations/create_admin_kit_company_histories_table.php.stub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\Schema; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
return new class extends Migration | ||
{ | ||
public function up(): void | ||
{ | ||
Schema::create('admin_kit_company_histories', function (Blueprint $table) { | ||
$table->id(); | ||
|
||
// add fields | ||
$table->foreignId('company_id') | ||
->constrained('admin_kit_companies') | ||
->cascadeOnDelete(); | ||
|
||
$table->jsonb('title')->nullable(); | ||
$table->jsonb('text')->nullable(); | ||
|
||
$table->integer('sort')->nullable(); | ||
|
||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
public function down(): void | ||
{ | ||
Schema::dropIfExists('admin_kit_company_histories'); | ||
} | ||
}; |
33 changes: 33 additions & 0 deletions
33
database/migrations/create_admin_kit_company_managers_table.php.stub
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
use Illuminate\Support\Facades\Schema; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
return new class extends Migration | ||
{ | ||
public function up(): void | ||
{ | ||
Schema::create('admin_kit_company_managers', function (Blueprint $table) { | ||
$table->id(); | ||
|
||
// add fields | ||
$table->foreignId('company_id') | ||
->constrained('admin_kit_companies') | ||
->cascadeOnDelete(); | ||
|
||
$table->jsonb('name'); | ||
$table->jsonb('bio')->nullable(); | ||
$table->jsonb('text')->nullable(); | ||
|
||
$table->integer('sort')->nullable(); | ||
|
||
$table->timestamps(); | ||
}); | ||
} | ||
|
||
public function down(): void | ||
{ | ||
Schema::dropIfExists('admin_kit_company_managers'); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace AdminKit\Companies\Actions; | ||
|
||
use Spatie\LaravelData\Data; | ||
use AdminKit\Companies\Models\Company; | ||
use AdminKit\Companies\UI\API\DTO\CompanyDTO; | ||
|
||
class GetCompany | ||
{ | ||
public function run(): Data | ||
{ | ||
$company = Company::query() | ||
->firstOrFail(); | ||
|
||
return CompanyDTO::from($company); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace AdminKit\Companies\Models; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
use Spatie\Translatable\HasTranslations; | ||
use Illuminate\Database\Eloquent\Factories\HasFactory; | ||
|
||
/** | ||
* @property-read int $company_id | ||
* @property-read ?string $title | ||
* @property-read ?string $text | ||
* @property-read ?string $sort | ||
*/ | ||
class History extends Model | ||
{ | ||
use HasFactory; | ||
use HasTranslations; | ||
|
||
protected $table = 'admin_kit_company_histories'; | ||
|
||
protected $fillable = [ | ||
'company_id', | ||
'title', | ||
'text', | ||
'sort', | ||
]; | ||
|
||
protected array $translatable = [ | ||
'title', | ||
'text', | ||
]; | ||
} |
Oops, something went wrong.