1. Go to this page and download the library: Download mosab/translation library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('employees', function (Blueprint $table) {
$table->id();
$table->float('salary');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('employees');
}
}
class EmployeeController extends Controller
{
// ...
public function store(Request $request)
{
// Validate the request...
$employee = new Employee();
$employee->name = [
'en' => 'name in english',
'ar' => 'name in arabic',
];
$employee->position = [
'en' => 'position in english',
'ar' => 'position in arabic',
];
$employee->salary = 5000,
$employee->save();
}
}
class EmployeeController extends Controller
{
// ...
public function store(Request $request)
{
// Validate the request...
$employee = Employee::create([
'name' => 'translation name',
'position' => 'translation position',
'salary' => 5000,
]);
}
}
class EmployeeController extends Controller
{
// ...
public function store(Request $request)
{
$request->validate([
'name' => [' $employee->name = $request->name,
$employee->position = $request->position,
$employee->salary = $request->salary,
$employee->save();
}
}
class EmployeeController extends Controller
{
// ...
public function update($id ,Request $request)
{
// Validate the request...
$employee = Employee::find($id);
$employee->name = [
'en' => 'name in english',
'ar' => 'name in arabic',
];
$employee->position = [
'en' => 'position in english',
'ar' => 'position in arabic',
];
$employee->save();
}
}
class EmployeeController extends Controller
{
// ...
public function update($id ,Request $request)
{
// Validate the request...
$employee = Employee::find($id);
$employee->update = [
'name' => ['en'=> 'name in english','ar'=> 'name in arabic'],
'position' => ['en'=> 'position in english','ar'=> 'position in arabic'],
];
}
}
class EmployeeController extends Controller
{
// ...
public function destroy($id)
{
$employee = Employee::find($id);
$employee->delete();
}
}
class EmployeeController extends Controller
{
// ...
public function show($id)
{
$employee = Employee::find($id);
return $employee;
}
}
Accept-Language : en;
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.