If status is successful how do I use model in normal php file without using blade.If you can help with this issue, I'm very home. When the file is a blade, it cannot be accessed from outside. i need to store it in php extension.Because this file asynchronously receives post array from outside
<?php
use App\Models\Paytr;
$paytr_ekle= new Paytr();
$paytr_ekle->hash="dsa";
$paytr_ekle->status="das";
$paytr_ekle->merchant_oid="dsa";
$paytr_ekle->save();
?>
Model File
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Paytr extends Model
{
protected $table = 'paytr';
public $timestamps = false;
public $primaryKey="paytr_id";
}
CodePudding user response:
Laravel blade engine provides a configuration file config/view.php , where you can add your custom view directories in it, place your public inside paths array and you are ready to go. whenever laravel tries to compile its view files it searches for blade files both in resources/view directory and public directory
// config/view.php
'paths' => [
resource_path('views'),
public_path(),
],
// web/route.php
Route::get('ex-page', function() {
return view('address.to.blade.file');
});
// as you added public_path to the paths array,
// files in public_path and resources/view path are considered to be adjacent