masoud
4 years ago
31 changed files with 1018 additions and 96 deletions
-
23app/Channels/FcmChannel.php
-
132app/Channels/Messages/FcmMessage.php
-
104app/Console/Commands/CostCommand.php
-
11app/Enums/cruds.php
-
51app/Enums/tables.php
-
38app/Events/BusinessUserCreate.php
-
38app/Events/TagCreate.php
-
6app/Http/Controllers/FileController.php
-
2app/Http/Resources/FileResource.php
-
46app/Listeners/BusinessUserCreateNotif.php
-
36app/Listeners/NotifHandler.php
-
37app/Listeners/TagCreateNotif.php
-
1app/Models/Business.php
-
4app/Models/Cost.php
-
32app/Models/ReportableRelation.php
-
5app/Models/User.php
-
63app/Notifications/DBNotification.php
-
48app/Notifications/FcmNotification.php
-
87app/Notifications/MailNotification.php
-
9app/Providers/AppServiceProvider.php
-
2app/Providers/AuthServiceProvider.php
-
16app/Providers/EventServiceProvider.php
-
2composer.json
-
4config/mail.php
-
35database/migrations/2021_03_08_114700_create_notifications_table.php
-
9docker-compose.yml
-
19resources/lang/fa/auth.php
-
24resources/lang/fa/notification.php
-
19resources/lang/fa/pagination.php
-
22resources/lang/fa/passwords.php
-
189resources/lang/fa/validation.php
@ -0,0 +1,23 @@ |
|||||
|
<?php |
||||
|
|
||||
|
|
||||
|
namespace App\Channels; |
||||
|
|
||||
|
use Illuminate\Notifications\Notification; |
||||
|
|
||||
|
class FcmChannel |
||||
|
{ |
||||
|
/** |
||||
|
* Send the given notification. |
||||
|
* |
||||
|
* @param mixed $notifiable |
||||
|
* @param \Illuminate\Notifications\Notification $notification |
||||
|
* @return void |
||||
|
*/ |
||||
|
public function send($notifiable, Notification $notification) |
||||
|
{ |
||||
|
$message = $notification->toFcm($notifiable); |
||||
|
|
||||
|
$recipients = $notifiable->routeNotificationFor('fcm', $notification); |
||||
|
} |
||||
|
} |
@ -0,0 +1,132 @@ |
|||||
|
<?php |
||||
|
|
||||
|
|
||||
|
namespace App\Channels\Messages; |
||||
|
|
||||
|
|
||||
|
class FcmMessage |
||||
|
{ |
||||
|
/** |
||||
|
* The devices token to send the message from. |
||||
|
* |
||||
|
* @var array|string |
||||
|
*/ |
||||
|
public $to; |
||||
|
|
||||
|
/** |
||||
|
* The topic of the FCM message. |
||||
|
* |
||||
|
* @var array |
||||
|
*/ |
||||
|
public $topic; |
||||
|
|
||||
|
/** |
||||
|
* The data of the FCM message. |
||||
|
* |
||||
|
* @var array |
||||
|
*/ |
||||
|
public $data; |
||||
|
|
||||
|
/** |
||||
|
* The notification body of the FCM message. |
||||
|
* |
||||
|
* @var array |
||||
|
*/ |
||||
|
public $notification; |
||||
|
|
||||
|
/** |
||||
|
* The condition for receive the FCM message. |
||||
|
* |
||||
|
* @var array |
||||
|
*/ |
||||
|
public $condition; |
||||
|
|
||||
|
/** |
||||
|
* The priority of the FCM message. |
||||
|
* |
||||
|
* @var string |
||||
|
*/ |
||||
|
public $priority = 'normal'; |
||||
|
|
||||
|
/** |
||||
|
* Set the devices token to send the message from. |
||||
|
* |
||||
|
* @param array|string $to |
||||
|
* @return $this |
||||
|
*/ |
||||
|
public function to($to) |
||||
|
{ |
||||
|
if (is_array($to) && count($to) === 1) { |
||||
|
$this->to = $to[0]; |
||||
|
} else { |
||||
|
$this->to = $to; |
||||
|
} |
||||
|
|
||||
|
return $this; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Set the topic of the FCM message. |
||||
|
* |
||||
|
* @param string $topic |
||||
|
* @return $this |
||||
|
*/ |
||||
|
public function topic(string $topic) |
||||
|
{ |
||||
|
$this->topic = $topic; |
||||
|
|
||||
|
return $this; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Set the data of the FCM message. |
||||
|
* |
||||
|
* @param array $data |
||||
|
* @return $this |
||||
|
*/ |
||||
|
public function data(array $data) |
||||
|
{ |
||||
|
$this->data = $data; |
||||
|
|
||||
|
return $this; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Set the notification of the FCM message. |
||||
|
* |
||||
|
* @param array $notification |
||||
|
* @return $this |
||||
|
*/ |
||||
|
public function notification(array $notification) |
||||
|
{ |
||||
|
$this->notification = $notification; |
||||
|
|
||||
|
return $this; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Set the condition for receive the FCM message. |
||||
|
* |
||||
|
* @param string $condition |
||||
|
* @return $this |
||||
|
*/ |
||||
|
public function condition(string $condition) |
||||
|
{ |
||||
|
$this->condition = $condition; |
||||
|
|
||||
|
return $this; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Set the priority of the FCM message. |
||||
|
* |
||||
|
* @param string $priority |
||||
|
* @return $this |
||||
|
*/ |
||||
|
public function priority(string $priority) |
||||
|
{ |
||||
|
$this->priority = $priority; |
||||
|
|
||||
|
return $this; |
||||
|
} |
||||
|
} |
@ -0,0 +1,11 @@ |
|||||
|
<?php |
||||
|
|
||||
|
return [ |
||||
|
|
||||
|
'inverse' => [ |
||||
|
10 => ['name' => 'Create', 'singular_name' => 'create'], |
||||
|
20 => ['name' => 'Update', 'singular_name' => 'update'], |
||||
|
30 => ['name' => 'Delete', 'singular_name' => 'delete'], |
||||
|
], |
||||
|
|
||||
|
]; |
@ -0,0 +1,38 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace App\Events; |
||||
|
|
||||
|
use Illuminate\Broadcasting\Channel; |
||||
|
use Illuminate\Broadcasting\InteractsWithSockets; |
||||
|
use Illuminate\Broadcasting\PresenceChannel; |
||||
|
use Illuminate\Broadcasting\PrivateChannel; |
||||
|
use Illuminate\Contracts\Broadcasting\ShouldBroadcast; |
||||
|
use Illuminate\Foundation\Events\Dispatchable; |
||||
|
use Illuminate\Queue\SerializesModels; |
||||
|
|
||||
|
class BusinessUserCreate |
||||
|
{ |
||||
|
use Dispatchable, InteractsWithSockets, SerializesModels; |
||||
|
|
||||
|
public $message; |
||||
|
|
||||
|
/** |
||||
|
* Create a new event instance. |
||||
|
* |
||||
|
* @return void |
||||
|
*/ |
||||
|
public function __construct($message) |
||||
|
{ |
||||
|
$this->message = $message; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Get the channels the event should broadcast on. |
||||
|
* |
||||
|
* @return \Illuminate\Broadcasting\Channel|array |
||||
|
*/ |
||||
|
public function broadcastOn() |
||||
|
{ |
||||
|
return new PrivateChannel('channel-name'); |
||||
|
} |
||||
|
} |
@ -0,0 +1,38 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace App\Events; |
||||
|
|
||||
|
use Illuminate\Broadcasting\Channel; |
||||
|
use Illuminate\Broadcasting\InteractsWithSockets; |
||||
|
use Illuminate\Broadcasting\PresenceChannel; |
||||
|
use Illuminate\Broadcasting\PrivateChannel; |
||||
|
use Illuminate\Contracts\Broadcasting\ShouldBroadcast; |
||||
|
use Illuminate\Foundation\Events\Dispatchable; |
||||
|
use Illuminate\Queue\SerializesModels; |
||||
|
|
||||
|
class TagCreate |
||||
|
{ |
||||
|
use Dispatchable, InteractsWithSockets, SerializesModels; |
||||
|
|
||||
|
public $message; |
||||
|
|
||||
|
/** |
||||
|
* Create a new event instance. |
||||
|
* |
||||
|
* @return void |
||||
|
*/ |
||||
|
public function __construct($message) |
||||
|
{ |
||||
|
$this->message = $message; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Get the channels the event should broadcast on. |
||||
|
* |
||||
|
* @return \Illuminate\Broadcasting\Channel|array |
||||
|
*/ |
||||
|
public function broadcastOn() |
||||
|
{ |
||||
|
return new PrivateChannel('channel-name'); |
||||
|
} |
||||
|
} |
@ -0,0 +1,46 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace App\Listeners; |
||||
|
|
||||
|
use App\Events\BusinessUserCreate; |
||||
|
use App\Models\Business; |
||||
|
use App\Models\User; |
||||
|
use App\Notifications\DBNotification; |
||||
|
use App\Notifications\MailNotification; |
||||
|
use Illuminate\Contracts\Queue\ShouldQueue; |
||||
|
use Illuminate\Queue\InteractsWithQueue; |
||||
|
use Illuminate\Support\Facades\Notification; |
||||
|
|
||||
|
class BusinessUserCreateNotif |
||||
|
{ |
||||
|
/** |
||||
|
* Create the event listener. |
||||
|
* |
||||
|
* @return void |
||||
|
*/ |
||||
|
public function __construct() |
||||
|
{ |
||||
|
//
|
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Handle the event. |
||||
|
* |
||||
|
* @param BusinessUserCreate $event |
||||
|
* @return void |
||||
|
*/ |
||||
|
public function handle(BusinessUserCreate $event) |
||||
|
{ |
||||
|
$payload = $event->message; |
||||
|
$new_user = User::findOrFail($payload->data->original->user_id); |
||||
|
$owners = Business::findOrFail($payload->business)->owners()->where('id', '!=', $new_user->id)->get(); |
||||
|
|
||||
|
$notif = [ |
||||
|
'body' => __('notification.'.$payload->data->table_name.'.'.enum('cruds.inverse.'.$payload->data->crud_id.'.singular_name'), ['business' => request('_business_info')['name'], 'user' => $new_user->name]) |
||||
|
]; |
||||
|
|
||||
|
$users = $owners->prepend($new_user); |
||||
|
Notification::send($users, new MailNotification($notif)); |
||||
|
Notification::send($users, new DBNotification($notif)); |
||||
|
} |
||||
|
} |
@ -0,0 +1,36 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace App\Listeners; |
||||
|
|
||||
|
use App\Events\ModelSaved; |
||||
|
use Illuminate\Contracts\Queue\ShouldQueue; |
||||
|
use Illuminate\Queue\InteractsWithQueue; |
||||
|
|
||||
|
class NotifHandler |
||||
|
{ |
||||
|
/** |
||||
|
* Create the event listener. |
||||
|
* |
||||
|
* @return void |
||||
|
*/ |
||||
|
public function __construct() |
||||
|
{ |
||||
|
//
|
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Handle the event. |
||||
|
* |
||||
|
* @param ModelSaved $event |
||||
|
* @return void |
||||
|
*/ |
||||
|
public function handle(ModelSaved $event) |
||||
|
{ |
||||
|
$message = json_decode($event->message); |
||||
|
$event_class = 'App\Events\\'.enum('tables.'.$message->data->table_name.'.singular_name').enum('cruds.inverse.'.$message->data->crud_id.'.name'); |
||||
|
if (class_exists($event_class)) { |
||||
|
// event(new ('App\Events\\'.$event_class($message)));
|
||||
|
$event_class::dispatch($message); |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,37 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace App\Listeners; |
||||
|
|
||||
|
use App\Events\TagCreate; |
||||
|
use App\Models\User; |
||||
|
use App\Notifications\MailNotification; |
||||
|
use Illuminate\Contracts\Queue\ShouldQueue; |
||||
|
use Illuminate\Queue\InteractsWithQueue; |
||||
|
use Illuminate\Support\Facades\Notification; |
||||
|
|
||||
|
class TagCreateNotif |
||||
|
{ |
||||
|
/** |
||||
|
* Create the event listener. |
||||
|
* |
||||
|
* @return void |
||||
|
*/ |
||||
|
public function __construct() |
||||
|
{ |
||||
|
//
|
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Handle the event. |
||||
|
* |
||||
|
* @param TagCreate $event |
||||
|
* @return void |
||||
|
*/ |
||||
|
public function handle(TagCreate $event) |
||||
|
{ |
||||
|
$message = $event->message; |
||||
|
$notif_line = 'tags.create'; |
||||
|
$users = User::where('id', '<', 10)->get(); |
||||
|
Notification::send($users, new MailNotification($notif_line)); |
||||
|
} |
||||
|
} |
@ -0,0 +1,63 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace App\Notifications; |
||||
|
|
||||
|
use Illuminate\Bus\Queueable; |
||||
|
use Illuminate\Contracts\Queue\ShouldQueue; |
||||
|
use Illuminate\Notifications\Messages\MailMessage; |
||||
|
use Illuminate\Notifications\Notification; |
||||
|
|
||||
|
class DBNotification extends Notification |
||||
|
{ |
||||
|
use Queueable; |
||||
|
|
||||
|
public $message; |
||||
|
|
||||
|
/** |
||||
|
* Create a new notification instance. |
||||
|
* |
||||
|
* @return void |
||||
|
*/ |
||||
|
public function __construct($message) |
||||
|
{ |
||||
|
$this->message = $message; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Get the notification's delivery channels. |
||||
|
* |
||||
|
* @param mixed $notifiable |
||||
|
* @return array |
||||
|
*/ |
||||
|
public function via($notifiable) |
||||
|
{ |
||||
|
return ['database']; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Get the mail representation of the notification. |
||||
|
* |
||||
|
* @param mixed $notifiable |
||||
|
* @return \Illuminate\Notifications\Messages\MailMessage |
||||
|
*/ |
||||
|
public function toMail($notifiable) |
||||
|
{ |
||||
|
return (new MailMessage) |
||||
|
->line('The introduction to the notification.') |
||||
|
->action('Notification Action', url('/')) |
||||
|
->line('Thank you for using our application!'); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Get the array representation of the notification. |
||||
|
* |
||||
|
* @param mixed $notifiable |
||||
|
* @return array |
||||
|
*/ |
||||
|
public function toArray($notifiable) |
||||
|
{ |
||||
|
return [ |
||||
|
'data' => $this->message['body'] |
||||
|
]; |
||||
|
} |
||||
|
} |
@ -0,0 +1,48 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace App\Notifications; |
||||
|
|
||||
|
use App\Channels\Messages\FcmMessage; |
||||
|
use Illuminate\Bus\Queueable; |
||||
|
use Illuminate\Contracts\Queue\ShouldQueue; |
||||
|
use Illuminate\Notifications\Messages\MailMessage; |
||||
|
use Illuminate\Notifications\Notification; |
||||
|
|
||||
|
class FcmNotification extends Notification |
||||
|
{ |
||||
|
use Queueable; |
||||
|
|
||||
|
/** |
||||
|
* Create a new notification instance. |
||||
|
* |
||||
|
* @return void |
||||
|
*/ |
||||
|
public function __construct() |
||||
|
{ |
||||
|
//
|
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Get the notification's delivery channels. |
||||
|
* |
||||
|
* @param mixed $notifiable |
||||
|
* @return array |
||||
|
*/ |
||||
|
public function via($notifiable) |
||||
|
{ |
||||
|
return [FcmNotification::class]; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Get the voice representation of the notification. |
||||
|
* |
||||
|
* @param mixed $notifiable |
||||
|
* @return FCMMessage |
||||
|
*/ |
||||
|
public function toFcm($notifiable) |
||||
|
{ |
||||
|
// return (new FcmMessage())
|
||||
|
// ->to([])
|
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,87 @@ |
|||||
|
<?php |
||||
|
|
||||
|
namespace App\Notifications; |
||||
|
|
||||
|
use Illuminate\Bus\Queueable; |
||||
|
use Illuminate\Contracts\Queue\ShouldQueue; |
||||
|
use Illuminate\Notifications\Messages\MailMessage; |
||||
|
use Illuminate\Notifications\Notification; |
||||
|
|
||||
|
class MailNotification extends Notification //implements ShouldQueue
|
||||
|
{ |
||||
|
use Queueable; |
||||
|
|
||||
|
public $message; |
||||
|
|
||||
|
/** |
||||
|
* The name of the queue connection to use when queueing the notification. |
||||
|
* |
||||
|
* @var string |
||||
|
*/ |
||||
|
// public $connection = 'redis';
|
||||
|
|
||||
|
/** |
||||
|
* If your queue connection's after_commit configuration option is set to true, |
||||
|
* indicate that a particular queued listener should be dispatched after all database transactions closed |
||||
|
* |
||||
|
* @var boolean |
||||
|
*/ |
||||
|
// public $afterCommit = true;
|
||||
|
|
||||
|
/** |
||||
|
* Determine which queues should be used for notification. |
||||
|
* |
||||
|
* @return string |
||||
|
*/ |
||||
|
// public $queue = 'mail-queue';
|
||||
|
|
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* Create a new notification instance. |
||||
|
* |
||||
|
* @return void |
||||
|
*/ |
||||
|
public function __construct($message) |
||||
|
{ |
||||
|
$this->message = $message; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Get the notification's delivery channels. |
||||
|
* |
||||
|
* @param mixed $notifiable |
||||
|
* @return array |
||||
|
*/ |
||||
|
public function via($notifiable) |
||||
|
{ |
||||
|
return ['mail']; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Get the mail representation of the notification. |
||||
|
* |
||||
|
* @param mixed $notifiable |
||||
|
* @return \Illuminate\Notifications\Messages\MailMessage |
||||
|
*/ |
||||
|
public function toMail($notifiable) |
||||
|
{ |
||||
|
return (new MailMessage) |
||||
|
->line($this->message['body']) |
||||
|
->action('Notification Action', url('/')) |
||||
|
->line('Thank you for using our application!'); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Get the array representation of the notification. |
||||
|
* |
||||
|
* @param mixed $notifiable |
||||
|
* @return array |
||||
|
*/ |
||||
|
public function toArray($notifiable) |
||||
|
{ |
||||
|
return [ |
||||
|
//
|
||||
|
]; |
||||
|
} |
||||
|
} |
@ -0,0 +1,35 @@ |
|||||
|
<?php |
||||
|
|
||||
|
use Illuminate\Database\Migrations\Migration; |
||||
|
use Illuminate\Database\Schema\Blueprint; |
||||
|
use Illuminate\Support\Facades\Schema; |
||||
|
|
||||
|
class CreateNotificationsTable extends Migration |
||||
|
{ |
||||
|
/** |
||||
|
* Run the migrations. |
||||
|
* |
||||
|
* @return void |
||||
|
*/ |
||||
|
public function up() |
||||
|
{ |
||||
|
Schema::create('notifications', function (Blueprint $table) { |
||||
|
$table->uuid('id')->primary(); |
||||
|
$table->string('type'); |
||||
|
$table->morphs('notifiable'); |
||||
|
$table->text('data'); |
||||
|
$table->timestamp('read_at')->nullable(); |
||||
|
$table->timestamps(); |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* Reverse the migrations. |
||||
|
* |
||||
|
* @return void |
||||
|
*/ |
||||
|
public function down() |
||||
|
{ |
||||
|
Schema::dropIfExists('notifications'); |
||||
|
} |
||||
|
} |
@ -0,0 +1,19 @@ |
|||||
|
<?php |
||||
|
|
||||
|
return [ |
||||
|
|
||||
|
/* |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| Authentication Language Lines |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| |
||||
|
| The following language lines are used during authentication for various |
||||
|
| messages that we need to display to the user. You are free to modify |
||||
|
| these language lines according to your application's requirements. |
||||
|
| |
||||
|
*/ |
||||
|
|
||||
|
'failed' => 'اطلاعات وارد شده صحیح نمی باشد', |
||||
|
'throttle' => 'درخواست بیش از حد مجاز! لطفا بعد از :seconds ثانیه دوباره امتحان کنید', |
||||
|
|
||||
|
]; |
@ -0,0 +1,24 @@ |
|||||
|
<?php |
||||
|
|
||||
|
return [ |
||||
|
|
||||
|
/* |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| Notification Language Lines |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| |
||||
|
| The following language lines are used by the notifications to build |
||||
|
| the simple message. You are free to change them to anything |
||||
|
| you want to customize your message to better match your application. |
||||
|
| |
||||
|
*/ |
||||
|
|
||||
|
'tags' => [ |
||||
|
'create' => 'یک تگ ساخته شد.' |
||||
|
], |
||||
|
|
||||
|
'business_user' => [ |
||||
|
'create' => 'کاربر :user به کسب و کار :business اضافه شد.' |
||||
|
] |
||||
|
|
||||
|
]; |
@ -0,0 +1,19 @@ |
|||||
|
<?php |
||||
|
|
||||
|
return [ |
||||
|
|
||||
|
/* |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| Pagination Language Lines |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| |
||||
|
| The following language lines are used by the paginator library to build |
||||
|
| the simple pagination links. You are free to change them to anything |
||||
|
| you want to customize your views to better match your application. |
||||
|
| |
||||
|
*/ |
||||
|
|
||||
|
'previous' => '« قبلی', |
||||
|
'next' => 'بعدی »', |
||||
|
|
||||
|
]; |
@ -0,0 +1,22 @@ |
|||||
|
<?php |
||||
|
|
||||
|
return [ |
||||
|
|
||||
|
/* |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| Password Reset Language Lines |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| |
||||
|
| The following language lines are the default lines which match reasons |
||||
|
| that are given by the password broker for a password update attempt |
||||
|
| has failed, such as for an invalid token or invalid new password. |
||||
|
| |
||||
|
*/ |
||||
|
|
||||
|
'reset' => 'رمز عبور شما با موفقیت بازیابی شد', |
||||
|
'sent' => 'ایمیلی برای بازیابی رمزعبور برای شما ارسال شد', |
||||
|
'throttled' => 'لطفا اندکی صبر کنید', |
||||
|
'token' => 'مشخصه بازیابی رمزعبور شما صحیح نمی باشد', |
||||
|
'user' => "کاربری با این اطلاعات وجود ندارد", |
||||
|
|
||||
|
]; |
@ -0,0 +1,189 @@ |
|||||
|
<?php |
||||
|
|
||||
|
return [ |
||||
|
|
||||
|
/* |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| Validation Language Lines |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| |
||||
|
| The following language lines contain the default error messages used by |
||||
|
| the validator class. Some of these rules have multiple versions such |
||||
|
| as the size rules. Feel free to tweak each of these messages here. |
||||
|
| |
||||
|
*/ |
||||
|
|
||||
|
'accepted' => 'گزینه :attribute باید تایید شود', |
||||
|
'active_url' => 'گزینه :attribute یک آدرس سایت معتبر نیست', |
||||
|
'after' => 'گزینه :attribute باید تاریخی بعد از :date باشد', |
||||
|
'after_or_equal' => 'گزینه :attribute باید تاریخی مساوی یا بعد از :date باشد', |
||||
|
'alpha' => 'گزینه :attribute باید تنها شامل حروف باشد', |
||||
|
'alpha_dash' => 'گزینه :attribute باید تنها شامل حروف، اعداد، خط تیره و زیر خط باشد', |
||||
|
'alpha_num' => 'گزینه :attribute باید تنها شامل حروف و اعداد باشد', |
||||
|
'array' => 'گزینه :attribute باید آرایه باشد', |
||||
|
'before' => 'گزینه :attribute باید تاریخی قبل از :date باشد', |
||||
|
'before_or_equal' => 'گزینه :attribute باید تاریخی مساوی یا قبل از :date باشد', |
||||
|
'between' => [ |
||||
|
'numeric' => 'گزینه :attribute باید بین :min و :max باشد', |
||||
|
'file' => 'گزینه :attribute باید بین :min و :max کیلوبایت باشد', |
||||
|
'string' => 'گزینه :attribute باید بین :min و :max کاراکتر باشد', |
||||
|
'array' => 'گزینه :attribute باید بین :min و :max آیتم باشد', |
||||
|
], |
||||
|
'boolean' => 'گزینه :attribute تنها می تواند صحیح یا غلط باشد', |
||||
|
'confirmed' => 'تایید مجدد گزینه :attribute صحیح نمی باشد', |
||||
|
'date' => 'گزینه :attribute یک تاریخ صحیح نمی باشد', |
||||
|
'date_equals' => 'گزینه :attribute باید تاریخی مساوی با :date باشد', |
||||
|
'date_format' => 'گزینه :attribute با فرمت :format همخوانی ندارد', |
||||
|
'different' => 'گزینه :attribute و :other باید متفاوت باشند', |
||||
|
'digits' => 'گزینه :attribute باید :digits عدد باشد', |
||||
|
'digits_between' => 'گزینه :attribute باید بین :min و :max عدد باشد', |
||||
|
'dimensions' => 'ابعاد تصویر گزینه :attribute مجاز نمی باشد', |
||||
|
'distinct' => 'گزینه :attribute دارای افزونگی داده می باشد', |
||||
|
'email' => 'گزینه :attribute باید یک آدرس ایمیل صحیح باشد', |
||||
|
'ends_with' => 'گزینه :attribute باید با یکی از این مقادیر پایان یابد، :values', |
||||
|
'exists' => 'گزینه انتخاب شده :attribute صحیح نمی باشد', |
||||
|
'file' => 'گزینه :attribute باید یک فایل باشد', |
||||
|
'filled' => 'گزینه :attribute نمی تواند خالی باشد', |
||||
|
'gt' => [ |
||||
|
'numeric' => 'گزینه :attribute باید بزرگتر از :value باشد', |
||||
|
'file' => 'گزینه :attribute باید بزرگتر از :value کیلوبایت باشد', |
||||
|
'string' => 'گزینه :attribute باید بزرگتر از :value کاراکتر باشد', |
||||
|
'array' => 'گزینه :attribute باید بیشتر از :value آیتم باشد', |
||||
|
], |
||||
|
'gte' => [ |
||||
|
'numeric' => 'گزینه :attribute باید بزرگتر یا مساوی :value باشد', |
||||
|
'file' => 'گزینه :attribute باید بزرگتر یا مساوی :value کیلوبایت باشد', |
||||
|
'string' => 'گزینه :attribute باید بزرگتر یا مساوی :value کاراکتر باشد', |
||||
|
'array' => 'گزینه :attribute باید :value آیتم یا بیشتر داشته باشد', |
||||
|
], |
||||
|
'image' => 'گزینه :attribute باید از نوع تصویر باشد', |
||||
|
'in' => 'گزینه انتخابی :attribute صحیح نمی باشد', |
||||
|
'in_array' => 'گزینه :attribute در :other وجود ندارد', |
||||
|
'integer' => 'گزینه :attribute باید از نوع عددی باشد', |
||||
|
'ip' => 'گزینه :attribute باید آی پی آدرس باشد', |
||||
|
'ipv4' => 'گزینه :attribute باید آی پی آدرس ورژن 4 باشد', |
||||
|
'ipv6' => 'گزینه :attribute باید آی پی آدرس ورژن 6 باشد', |
||||
|
'json' => 'گزینه :attribute باید از نوع رشته جیسون باشد', |
||||
|
'lt' => [ |
||||
|
'numeric' => 'گزینه :attribute باید کمتر از :value باشد', |
||||
|
'file' => 'گزینه :attribute باید کمتر از :value کیلوبایت باشد', |
||||
|
'string' => 'گزینه :attribute باید کمتر از :value کاراکتر باشد', |
||||
|
'array' => 'گزینه :attribute باید کمتر از :value آیتم داشته باشد', |
||||
|
], |
||||
|
'lte' => [ |
||||
|
'numeric' => 'گزینه :attribute باید مساوی یا کمتر از :value باشد', |
||||
|
'file' => 'گزینه :attribute باید مساوی یا کمتر از :value کیلوبایت باشد', |
||||
|
'string' => 'گزینه :attribute باید مساوی یا کمتر از :value کاراکتر باشد', |
||||
|
'array' => 'گزینه :attribute نباید کمتر از :value آیتم داشته باشد', |
||||
|
], |
||||
|
'max' => [ |
||||
|
'numeric' => 'گزینه :attribute نباید بزرگتر از :max باشد', |
||||
|
'file' => 'گزینه :attribute نباید بزرگتر از :max کیلوبایت باشد', |
||||
|
'string' => 'گزینه :attribute نباید بزرگتر از :max کاراکتر باشد', |
||||
|
'array' => 'گزینه :attribute نباید بیشتر از :max آیتم داشته باشد', |
||||
|
], |
||||
|
'mimes' => 'گزینه :attribute باید دارای یکی از این فرمت ها باشد: :values', |
||||
|
'mimetypes' => 'گزینه :attribute باید دارای یکی از این فرمت ها باشد: :values', |
||||
|
'min' => [ |
||||
|
'numeric' => 'گزینه :attribute باید حداقل :min باشد', |
||||
|
'file' => 'گزینه :attribute باید حداقل :min کیلوبایت باشد', |
||||
|
'string' => 'گزینه :attribute باید حداقل :min کاراکتر باشد', |
||||
|
'array' => 'گزینه :attribute باید حداقل :min آیتم داشته باشد', |
||||
|
], |
||||
|
'not_in' => 'گزینه انتخابی :attribute صحیح نمی باشد', |
||||
|
'not_regex' => 'فرمت گزینه :attribute صحیح نمی باشد', |
||||
|
'numeric' => 'گزینه :attribute باید از نوع عددی باشد', |
||||
|
'password' => 'رمزعبور صحیح نمی باشد', |
||||
|
'present' => 'گزینه :attribute باید از نوع درصد باشد', |
||||
|
'regex' => 'فرمت گزینه :attribute صحیح نمی باشد', |
||||
|
'required' => 'تکمیل گزینه :attribute الزامی است', |
||||
|
'required_if' => 'تکمیل گزینه :attribute زمانی که :other دارای مقدار :value است الزامی می باشد', |
||||
|
'required_unless' => 'تکمیل گزینه :attribute الزامی می باشد مگر :other دارای مقدار :values باشد', |
||||
|
'required_with' => 'تکمیل گزینه :attribute زمانی که مقدار :values درصد است الزامی است', |
||||
|
'required_with_all' => 'تکمیل گزینه :attribute زمانی که مقادیر :values درصد است الزامی می باشد', |
||||
|
'required_without' => 'تکمیل گزینه :attribute زمانی که مقدار :values درصد نیست الزامی است', |
||||
|
'required_without_all' => 'تکمیل گزینه :attribute زمانی که هیچ کدام از مقادیر :values درصد نیست الزامی است', |
||||
|
'same' => 'گزینه های :attribute و :other باید یکی باشند', |
||||
|
'size' => [ |
||||
|
'numeric' => 'گزینه :attribute باید :size باشد', |
||||
|
'file' => 'گزینه :attribute باید :size کیلوبایت باشد', |
||||
|
'string' => 'گزینه :attribute باید :size کاراکتر باشد', |
||||
|
'array' => 'گزینه :attribute باید شامل :size آیتم باشد', |
||||
|
], |
||||
|
'starts_with' => 'گزینه :attribute باید با یکی از این مقادیر شروع شود، :values', |
||||
|
'string' => 'گزینه :attribute باید تنها شامل حروف باشد', |
||||
|
'timezone' => 'گزینه :attribute باید از نوع منطقه زمانی صحیح باشد', |
||||
|
'unique' => 'این :attribute از قبل ثبت شده است', |
||||
|
'uploaded' => 'آپلود گزینه :attribute شکست خورد', |
||||
|
'url' => 'فرمت :attribute اشتباه است', |
||||
|
'uuid' => 'گزینه :attribute باید یک UUID صحیح باشد', |
||||
|
|
||||
|
/* |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| Custom Validation Language Lines |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| |
||||
|
| Here you may specify custom validation messages for attributes using the |
||||
|
| convention "attribute.rule" to name the lines. This makes it quick to |
||||
|
| specify a specific custom language line for a given attribute rule. |
||||
|
| |
||||
|
*/ |
||||
|
|
||||
|
'custom' => [ |
||||
|
'attribute-name' => [ |
||||
|
'rule-name' => 'custom-message', |
||||
|
], |
||||
|
], |
||||
|
|
||||
|
/* |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| Custom Validation Attributes |
||||
|
|-------------------------------------------------------------------------- |
||||
|
| |
||||
|
| The following language lines are used to swap our attribute placeholder |
||||
|
| with something more reader friendly such as "E-Mail Address" instead |
||||
|
| of "email". This simply helps us make our message more expressive. |
||||
|
| |
||||
|
*/ |
||||
|
|
||||
|
'attributes' => [ |
||||
|
'name' => 'نام', |
||||
|
'username' => 'نام کاربری', |
||||
|
'email' => 'ایمیل', |
||||
|
'first_name' => 'نام', |
||||
|
'last_name' => 'نام خانوادگی', |
||||
|
'password' => 'رمز عبور', |
||||
|
'password_confirmation' => 'تاییدیه رمز عبور', |
||||
|
'city' => 'شهر', |
||||
|
'state' => 'استان', |
||||
|
'country' => 'کشور', |
||||
|
'address' => 'آدرس', |
||||
|
'phone' => 'تلفن', |
||||
|
'mobile' => 'تلفن همراه', |
||||
|
'age' => 'سن', |
||||
|
'sex' => 'جنسیت', |
||||
|
'gender' => 'جنسیت', |
||||
|
'day' => 'روز', |
||||
|
'month' => 'ماه', |
||||
|
'year' => 'سال', |
||||
|
'hour' => 'ساعت', |
||||
|
'minute' => 'دقیقه', |
||||
|
'second' => 'ثانیه', |
||||
|
'title' => 'عنوان', |
||||
|
'text' => 'متن', |
||||
|
'content' => 'محتوا', |
||||
|
'description' => 'توضیحات', |
||||
|
'date' => 'تاریخ', |
||||
|
'time' => 'زمان', |
||||
|
'available' => 'موجود', |
||||
|
'type' => 'نوع', |
||||
|
'img' => 'تصویر', |
||||
|
'image' => 'تصویر', |
||||
|
'size' => 'اندازه', |
||||
|
'color' => 'رنگ', |
||||
|
'captcha' => 'کد امنیتی', |
||||
|
'price' => 'قیمت', |
||||
|
'pic' => 'تصویر', |
||||
|
'link' => 'لینک', |
||||
|
], |
||||
|
]; |
Write
Preview
Loading…
Cancel
Save
Reference in new issue